1.0.7 • Published 10 years ago

fspvr v1.0.7

Weekly downloads
3
License
GPL-3.0+
Repository
github
Last release
10 years ago

fspvr - Cross-Platform filesystem path validator and reformer

NPM

Build status Coverage Status Dependency Status devDependency Status

fspvr is a cross-platform filesystem validator and reformer which gets rid of illegal trailing or in-between characters and preserved words.

Table of contents


Reformat

var fspvr = require('fspvr');
var reformatedPath = fspvr.reformatPath('C:\\Windows?\\<System32>\\ntdll.dll', true);
console.log(reformatedPath); // C:\Windows\System32\ntdll.dll

The second parameter is optional and defaults to true. Its responisible for strict reformation, meaning it will remove illegal trailing characters or preserved words.

Optinally, you can reformat only a segment in a path

var fspvr = require('fspvr');
var reformatedSegment = fspvr.reformatSegment('Windows?', true);
console.log(reformatedSegment); // Windows

The second parameter is for strict reformation as described above.

Validate

var fspvr = require('fspvr');
var isValidPath = fspvr.validatePath('C:\\Windows?\\<System32>\\ntdll.dll', true);
console.log(isValidPath); // false

The second parameter is optional and defaults to true. Its responisible for strict validation, meaning it will validates againts illegal characters as-well as to illegal trailing characters or preserved words.

Optinally, you can validate only a segment in a path

var fspvr = require('fspvr');
var isValidSegment = fspvr.validateSegment('Windows', true);
console.log(isValidSegment); // true

The second parameter is for strict validation as described above.

Tests

Run tests with $ npm run test

License

fspvr is licensed under the GPL V3 License.

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago