Skip to content

handlebauer/local-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@hbauer/local-file

Install

$ yarn add @hbauer/local-file
$ npm install @hbauer/local-file

Usage

import { LocalFile } from '@hbauer/local-file'

const path = 'src/path/to/data'
const data = { foo: 'bar' }

const savedFile = await LocalFile.save(path, data)

assert(savedFile.data === data)
assert(typeof savedFile.createdAt.date === 'date')
assert(typeof savedFile.createdAt.milliseconds === 'number')

const file = await LocalFile.read(path, data) // throws error if the file doesn't exist

assert.deepEqual(savedFile.data, file.data)

// TODO: finish readme

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published