Skip to main content

bud.fs

bud.fs is a collection of utilities to help with common filesystem based tasks.

All bud.fs functions take paths relative to the project's root directory. You can also create new instances with a different context using bud.fs.make. This is useful for code readability if you need to do several tasks on files in a shared, non-root directory:

const source = bud.fs.make(bud.path(`@src`)) // make a new bud.fs instance with a root in `src`
await source.copy(`foo`, `bar`) // copy src/foo to src/bar
await source.write(`hello.txt`, `hello world`) // write `hello world` to src/hello.txt

bud.fs.json

Utilities for reading and writing json. See bud.fs.json documentation for more information.

bud.fs.yml

Utilities for reading and writing yml. See bud.fs.yml documentation for more information.

bud.fs.s3

bud.fs includes built-in support for working with remote files stored in S3.

Once installed, you can set your credentials and bucket name in your bud configuration and do uploads:

bud.fs
.setCredentials({accessKeyId: `***`, secretAccessKey: `***`})
.setEndpoint(`https://sfo2.digitaloceanspaces.com`)
.setBucket('my-bucket')
.upload()

See bud.fs.s3 documentation for more information on how to use these features.