Socket
Socket
Sign inDemoInstall

njfs

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

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
458
decreased by-0.65%
Maintainers
1
Install size
7.83 kB
Created
Weekly downloads
 

Readme

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, opts): 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, root, list, isDir} = require('njfs');

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

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

        const dist = root() + 'src';
        const dest = root() + 'dist/js';

        try {
            const files = await list(dist, {extensions:'js, jsx'});
            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

Last updated on 15 Mar 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc