JSPM

bestikk-fs

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q58257F
  • License MIT

A simple tool to do common file operations

Package Exports

  • bestikk-fs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bestikk-fs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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"');