1.0.0 • Published 6 years ago

bestikk-fs v1.0.0

Weekly downloads
108
License
MIT
Repository
github
Last release
6 years ago

Bestikk FS

ifdef::env-github[] image:http://img.shields.io/travis/bestikk/bestikk-fs.svg[Travis build status, link=https://travis-ci.org/bestikk/bestikk-fs] image:http://img.shields.io/npm/v/bestikk-fs.svg[npm version, link=https://www.npmjs.org/package/bestikk-fs] endif::[]

A simple tool to do common file operations.

Install

$ npm i --save-dev bestikk-fs

Usage

const bfs = require('bestikk-fs')

// Synchronously remove 'confidential' directory recursively
bfs.removeSync('confidential');

// Synchronously create 'foo', 'bar' and 'baz' directories
bfs.mkdirsSync('foo/bar/baz');

// Synchronously copy 'foo' directory and all its content to 'bar' directory
bfs.copySync('foo', 'bar');

// Walk through a directory and call the callback function on each file
bfs.walk('foo', (path, stat) => console.log('path: ' + path + ', stat:' + stat))

// Asynchronously untar 'foo.tar.gz' to 'bar' directory (and rename tar base directory to 'qux')
bfs.untar('foo.tar.gz', 'qux', 'bar')
  .then(() => /* do something */)

// Synchronously concat the content of 'foo', 'bar', 'baz' files into 'quz'
bfs.concatSync(['foo', 'bar', 'baz'], 'quz');

// Synchronously copy 'foo' file to 'bar' directory (ie. file will be copied to 'bar/foo')
bfs.copyToDirSync('foo', 'bar');

// Synchronously update the version in 'package.json' with '1.0.0'
bfs.updateFileSync('package.json', /"version": "(.*?)"/g, '"version": "1.0.0"');
1.0.0

6 years ago

0.1.0

8 years ago