PageSourceSearch

https://bud.js.org/assets/js/2fd11cbc.d38ab897.js

js bud.js.org collected 2026-10-09 22:10:27 UTC 2,769 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_repo_docs=self.webpackChunk_repo_docs||[]).push([[1211],{5310:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>d,contentTitle:()=>o,default:()=>h,frontMatter:()=>r,metadata:()=>c,toc:()=>a});var n=t(4512),i=t(3250);const r={title:"bud.fs.exists",description:"Checks whether something exists on a given path.",sidebar_label:"exists"},o=void 0,c={id:"bud.fs/exists",title:"bud.fs.exists",description:"Checks whether something exists on a given path.",source:"@site/content/reference/bud.fs/exists.mdx",sourceDirName:"bud.fs",slug:"/bud.fs/exists",permalink:"/reference/bud.fs/exists",draft:!1,unlisted:!1,editUrl:"https://github.com/roots/bud/edit/main/sources/@repo/docs/content/reference/bud.fs/exists.mdx",tags:[],version:"current",frontMatter:{title:"bud.fs.exists",description:"Checks whether something exists on a given path.",sidebar_label:"exists"},sidebar:"items",previous:{title:"dir",permalink:"/reference/bud.fs/dir"},next:{title:"find",permalink:"/reference/bud.fs/find"}},d={},a=[{value:"Usage",id:"usage",level:2}];function l(e){const s={code:"code",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.p,{children:"Check whether something exists on a given path."}),"\n",(0,n.jsx)(s.h2,{id:"usage",children:"Usage"}),"\n",(0,n.jsxs)(s.p,{children:[(0,n.jsx)(s.code,{children:"bud.fs.exists"})," returns different values depending on what is found at the given path."]}),"\n",(0,n.jsxs)(s.ul,{children:["\n",(0,n.jsxs)(s.li,{children:[(0,n.jsx)(s.code,{children:"false"})," if the path doesn't exist"]}),"\n",(0,n.jsxs)(s.li,{children:[(0,n.jsx)(s.code,{children:"dir"})," if the path is a directory"]}),"\n",(0,n.jsxs)(s.li,{children:[(0,n.jsx)(s.code,{children:"file"})," if the path is a file"]}),"\n",(0,n.jsxs)(s.li,{children:[(0,n.jsx)(s.code,{children:"other"})," if the none of the above"]}),"\n"]}),"\n",(0,n.jsx)(s.pre,{children:(0,n.jsx)(s.code,{className:"language-typescript",children:"const result = await bud.fs.exists(`path/to/dir`)\n// result => `dir`\n"})}),"\n",(0,n.jsx)(s.pre,{children:(0,n.jsx)(s.code,{className:"language-typescript",children:"const result = await bud.fs.exists(`not/a/path`)\n// result => `false`\n"})})]})}function h(e={}){const{wrapper:s}={...(0,i.a)(),...e.components};return s?(0,n.jsx)(s,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},3250:(e,s,t)=>{t.d(s,{Z:()=>c,a:()=>o});var n=t(2735);const i={},r=n.createContext(i);function o(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function c(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.