Skip to main content


Write a file from the filesystem.


bud.fs.write takes a minimum of two arguments:

  • path - The path to the file to write
  • content - The content to write to the file
await bud.fs.write(``, `# Hello, world!`)

If you pass an object as the content parameter it will be written as json.

await bud.fs.write(`demo.json`, {foo: 'bar'})

In addition to the two required arguments, bud.fs.write also takes an optional third argument for options:

type WriteOptions = {
mode?: string | number
atomic?: boolean
spaces?: number
await bud.fs.write(`demo.json`, {foo: 'bar'}, {spaces: 2})