1.0.1-beta • Published 7 years ago

@piq9117/write-file v1.0.1-beta

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

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

1.0.1-beta

7 years ago

1.0.10-alpha

7 years ago

1.0.9-alpha

7 years ago

1.0.8-alpha

7 years ago

1.0.7-alpha

7 years ago

1.0.6-alpha

7 years ago

1.0.5-alpha

7 years ago

1.0.4-alpha

7 years ago

1.0.3-alpha

7 years ago

1.0.2-alpha

7 years ago

1.0.1-alpha

7 years ago

1.0.0-alpha

7 years ago

1.0.0-beta

7 years ago

1.0.0

7 years ago