Socket
Socket
Sign inDemoInstall

njfs

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

njfs

A small collection of sync & async filesystem functions in Node.js.


Version published
Weekly downloads
856
increased by6.73%
Maintainers
1
Weekly downloads
 
Created
Source

Node Js File System

Build Status devDependencies Status Maintainability Snyk Vulnerabilities for GitHub Repo npm NPM Version contributions welcome

A small collection of sync & async filesystem functions for Node Js.

Install

npm install --save-dev njfs

Methods

  1. unix(path): Synchronous. Returns path with unix-like directory separators.
  2. root(path): Synchronous. Returns the root directory of the package.
  3. list(path): Asynchronous. Returns the list of files and folders of the given path.
  4. move(path, dest): Asynchronous. Moves files or folders.
  5. copy(path, dest): Asynchronous. Copies files or folders.
  6. isFile(path): Synchronous. Checks whether the specified path is an existing file or not.
  7. isDir(path): Synchronous. Checks whether the specified path is an existing directory or not.

Usage

const {move, copy, list, isDir} = require('njfs');

gulp.task('example', async () =>

    await gulp.watch(['./src/**/*.js'], gulp.series('build', async () => {

        const dist = 'vhosts/a';
        const dest = 'vhosts/a/b/c/js';

        try {
            const files = await list(dist);
            await Promise.all(files.map(async (file) => {
                const path = `${dist}/${file}`;
                if (!isDir(path)) {
                    await copy(path, dest);
                    console.log(`${file} transfered to ${dest}`);
                }
            }));
        } catch (e) {
            console.log(e);
        }
    })
));

Troubleshooting

When you encounter a problem, please open an issue. I would be glad to help you to find a solution if possible.

Author

Github: @orcunsaltik

License

See the LICENSE file for license rights and limitations (MIT).

Keywords

FAQs

Package last updated on 11 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc