🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

asort

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asort

Renaming files in ascending order

0.0.1
latest
Source
npm
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

asort

Renaming files in ascending order

Build Status Version Downloads MIT License Dependency Status NSP Status Greenkeeper badge

Code of Conduct

A package helps renaming files in an ascending order. Each renamed file will contain its own index starting from 1.

Pre-requisite

  • Node.js >= 8.6.0
  • NPM >= 5.3.0 (NPM comes Node.js so there is no need to install separately.)

How to use

It can be used as a dependency or as a CLI directly from your favorite terminal.

To use it as a dependency

# Install it as a dependency in your project
npm install --save asort

# Import the package via 'require'
const { asort } = require('asort'); # OR const asort = require('asort').default;

# Import the package with ES module
import asort from 'asort';

To install the CLI

You can choose to either use the CLI directly with npx or to install the CLI globally with NPM.

* Please note that as of npx is bundled with NPM as of the version of 5.2.0.

# Use CLI with npx
$ npx asort <command>

# Install globally via NPM
$ npm install -g asort

Commands

  • Show help via -h or --help.

    # asort --help
    $ asort -h
    
  • Show version via -v or --version.

    # asort --version
    $ asort -v
    
  • Rename files

    # Rename files in current directory
    $ asort ./
    
    # Rename files with defined directory path
    $ asort ~/my-videos/
    
    # Rename files with defined language for sorting files before renaming
    $ asort ~/my-videos/ -l "ja-JP"
    
    # Rename files with RegExp + replacer function
    $ asort ~/my-videos/ -r "/^(\\S+)[\\s\\S]*?(\\d*)\\.(\\w+)\$/i" -p "\$1 - \$2.\$3"
    

API reference

asort(dirName[, lang = 'en-US', regex, replace])

  • dirname <string> Path to the directory that contains files to be renamed.
  • lang <string> Language of the files to be renamed. This is needed for sorting the files before renaming. Defaults to en-US.
  • regex <string|Regex> Custom RegExp to filter files that need to be renamed.
  • replacer <string|Function> Custom replacer string or function when renaming the files.

License

MIT License © Rong Sen Ng

Keywords

asort

FAQs

Package last updated on 15 Oct 2017

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