2.0.0 • Published 10 years ago

chuck-steve-package-folder v2.0.0

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

Steve Package Folder

A wrapper for performing actions on the package folder in steve packages.

Usage

Requiring this package returns a PackageFolder class. The class has the following methods:

.constructor()

Takes a single string containing the absolute folder path

.isValid()

Returns a Promise that resolves to true if the folder can be written to and read from

#clear()

Clears the folder
Returns a Promise

#add(filePath, index)

Copies the file located at the absolute path into the folder prefixed with the index in 000_ format
Returns a Promise

Example

const PackageFolder = require('chuck-steve-package-folder');
let packageFolder = new PackageFolder('some folder path');

packageFolder
  .isValid()
  .then((isValid) => {
    if(isValid) {
      return packageFolder
        .clear()
        .then(() => packageFolder.add('some file path', 1));
    }
  })
  .catch(console.error);
2.0.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago