@piq9117/write-file
v1.0.1-beta
Published
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`
Downloads
3
Readme
Write File
I usually use writeFile
to write my stubs that are generated from casual,
a fake data generator.
This is how it looks when I use writeFile
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!!
To install:
npm install @piq9117/write-file
Then import write-file
import { writeFile } from '@piq9117/write-file'
To use writeFile
:
// 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