I usually use `writeFile` to write my stubs that are generated from [casual](https://github.com/boo1ean/casual), a fake data generator. <br /> This is how it looks when I use `writeFile`
npm install @piq9117/write-filewriteFile to write my stubs that are generated from casual,writeFile``javascript
import * as casual from 'casual'
import { writeFile } from '@piq9117/write-file'
import { times } from 'ramda'
const person = () => ({
firstName: casual.first_name,
lastName: casual.last_name
})
const personStub = times(person, 50)
writeFile('./stub', 'person.json', JSON.stringify(personStub))
`
Becareful with the filenames you are using because it will be overwritten!!
npm install @piq9117/write-file
`
Then import write-file
`javascript
import { writeFile } from '@piq9117/write-file'
`
To use writeFile:
`javascript
// writeFile :: string -> string -> string -> IO ()writeFile('./directoryPath', 'fileName.json', JSON.stringify({test: 'this is a test'}))
// or
writeFile('./directoryPath', 'anotherFileName.txt', 'this is a text file')
`
When you run this, the console should say:
`
success
success
`
This will create fileName.txt inside directoryPath` folder