bud.fs.write
Write a file from the filesystem.
Usage
bud.fs.write
takes a minimum of two arguments:
path
- The path to the file to writecontent
- The content to write to the file
await bud.fs.write(`readme.md`, `# 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})
Related
- bud.fs.json.write - Write a JSON file