@piq9117/write-file
TypeScript icon, indicating that this package has built-in type declarations

1.0.1-beta • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i @piq9117/write-file

Weekly Downloads

1

Version

1.0.1-beta

License

ISC

Last publish

Collaborators

  • piq9117