0.1.0 • Published 7 years ago

keep-it-small v0.1.0

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

keep-it-small

fs utility for ensuring a directory is smaller than X bytes.

Useful when you want to cache some files into a directory-this handles cleaning up old files for you. All you have to do is specify the maximum size of the directory.

usage

import kis from 'keep-it-simple'

kis('./my-awesome-cache', '3kb').then((cache) => {
  cache.write('1', 'file content')
  cache.write('2', 'file 2 content')
})

//for reading, use regular fs methods

methods

size

returns integer - current size in bytes

purge()

Removes All

writeSync()

write()

returns a promise