Socket
Socket
Sign inDemoInstall

@absolunet/fss

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@absolunet/fss - npm Package Compare versions

Comparing version 1.3.3 to 1.4.0

lib/json5.js

5

index.js

@@ -10,2 +10,3 @@ //--------------------------------------------------------

const json = require('./lib/json');
const json5 = require('./lib/json5');
const misc = require('./lib/misc');

@@ -77,2 +78,6 @@ const xml = require('./lib/xml');

get readJson5() { return json5.read; }
get writeJson5() { return json5.write; }
get outputJson5() { return json5.output; }
get readXml() { return xml.read; }

@@ -79,0 +84,0 @@ get writeXml() { return xml.write; }

18

lib/compression.js

@@ -27,3 +27,3 @@ //--------------------------------------------------------

read(file) {
ow(file, ow.string.label('file').nonEmpty);
ow(file, ow.string.nonEmpty);

@@ -35,4 +35,4 @@ return read(file);

write(file, content) {
ow(file, ow.string.label('file').nonEmpty);
ow(content, ow.string.label('content').nonEmpty);
ow(file, ow.string.nonEmpty);
ow(content, ow.string.nonEmpty);

@@ -44,4 +44,4 @@ return write(file, content);

output(file, content) {
ow(file, ow.string.label('file').nonEmpty);
ow(content, ow.string.label('content').nonEmpty);
ow(file, ow.string.nonEmpty);
ow(content, ow.string.nonEmpty);

@@ -54,4 +54,4 @@ utils.ensureContainingFolder(file);

compress(source, destination = `${source}.gz`) {
ow(source, ow.string.label('source').nonEmpty);
ow(destination, ow.string.label('destination').nonEmpty);
ow(source, ow.string.nonEmpty);
ow(destination, ow.string.nonEmpty);

@@ -65,4 +65,4 @@ write(destination, gracefulFs.readFileSync(source));

decompress(source, destination = source.replace(/\.gz$/u, '')) {
ow(source, ow.string.label('source').nonEmpty);
ow(destination, ow.string.label('destination').nonEmpty);
ow(source, ow.string.nonEmpty);
ow(destination, ow.string.nonEmpty);

@@ -69,0 +69,0 @@ gracefulFs.writeFileSync(destination, read(source));

@@ -22,4 +22,4 @@ //--------------------------------------------------------

read(file, reviver) {
ow(file, ow.string.label('file').nonEmpty);
ow(reviver, ow.any(ow.undefined.label('options'), ow.function.label('options')));
ow(file, ow.string.nonEmpty);
ow(reviver, ow.optional.function);

@@ -31,5 +31,5 @@ return JSON.parse(utils.readMaybeCompressedFile(file).replace(/^\uFEFF/u, ''), reviver);

write(file, object, options) {
ow(file, ow.string.label('file').nonEmpty);
ow(object, ow.object.label('object'));
ow(options, ow.any(ow.undefined.label('options'), ow.object.label('options')));
ow(file, ow.string.nonEmpty);
ow(object, ow.object);
ow(options, ow.optional.object);

@@ -41,5 +41,5 @@ write(file, object, options);

output(file, object, options) {
ow(file, ow.string.label('file').nonEmpty);
ow(object, ow.object.label('object'));
ow(options, ow.any(ow.undefined.label('options'), ow.object.label('options')));
ow(file, ow.string.nonEmpty);
ow(object, ow.object);
ow(options, ow.optional.object);

@@ -46,0 +46,0 @@ utils.ensureContainingFolder(file);

@@ -17,8 +17,8 @@ //--------------------------------------------------------

scandir(root, type, { recursive = false, fullPath = false, pattern = '**', keepJunk = false } = {}) {
ow(root, ow.string.label('root').nonEmpty);
ow(type, ow.string.label('type').nonEmpty.is(() => { return ['file', 'dir'].includes(type) || `Must be 'file' or 'dir'`; }));
ow(recursive, ow.boolean.label('recursive'));
ow(fullPath, ow.boolean.label('fullPath'));
ow(pattern, ow.string.label('pattern').nonEmpty);
ow(keepJunk, ow.boolean.label('keepJunk'));
ow(root, ow.string.nonEmpty);
ow(type, ow.string.nonEmpty.is(() => { return ['file', 'dir'].includes(type) || `Must be 'file' or 'dir'`; }));
ow(recursive, ow.boolean);
ow(fullPath, ow.boolean);
ow(pattern, ow.string.nonEmpty);
ow(keepJunk, ow.boolean);

@@ -25,0 +25,0 @@ // Remove trailing slash

@@ -24,4 +24,4 @@ //--------------------------------------------------------

read(file, options) {
ow(file, ow.string.label('file').nonEmpty);
ow(options, ow.any(ow.undefined.label('options'), ow.object.label('options')));
ow(file, ow.string.nonEmpty);
ow(options, ow.optional.object);

@@ -33,5 +33,5 @@ return xml2jsParser.parseStringSync(utils.readMaybeCompressedFile(file), options);

write(file, object, options) {
ow(file, ow.string.label('file').nonEmpty);
ow(object, ow.object.label('object'));
ow(options, ow.any(ow.undefined.label('options'), ow.object.label('options')));
ow(file, ow.string.nonEmpty);
ow(object, ow.object);
ow(options, ow.optional.object);

@@ -43,5 +43,5 @@ return write(file, object, options);

output(file, object, options) {
ow(file, ow.string.label('file').nonEmpty);
ow(object, ow.object.label('object'));
ow(options, ow.any(ow.undefined.label('options'), ow.object.label('options')));
ow(file, ow.string.nonEmpty);
ow(object, ow.object);
ow(options, ow.optional.object);

@@ -48,0 +48,0 @@ utils.ensureContainingFolder(file);

@@ -23,3 +23,3 @@ //--------------------------------------------------------

read(file) {
ow(file, ow.string.label('file').nonEmpty);
ow(file, ow.string.nonEmpty);

@@ -31,4 +31,4 @@ return yaml.safeLoad(utils.readMaybeCompressedFile(file));

write(file, object) {
ow(file, ow.string.label('file').nonEmpty);
ow(object, ow.object.label('object'));
ow(file, ow.string.nonEmpty);
ow(object, ow.object);

@@ -40,4 +40,4 @@ write(file, object);

output(file, object) {
ow(file, ow.string.label('file').nonEmpty);
ow(object, ow.object.label('object'));
ow(file, ow.string.nonEmpty);
ow(object, ow.object);

@@ -44,0 +44,0 @@ utils.ensureContainingFolder(file);

{
"name": "@absolunet/fss",
"version": "1.3.3",
"version": "1.4.0",
"description": "graceful-fs / fs-extra sync wrapper with goodies",

@@ -17,2 +17,3 @@ "definition": "",

"gzip",
"json5",
"klaw",

@@ -32,3 +33,3 @@ "sync",

"engines": {
"node": ">= 11.2.0"
"node": ">= 11.8.0"
},

@@ -39,7 +40,8 @@ "main": "index.js",

"graceful-fs": "^4.1.11",
"js-yaml": "^3.12.0",
"js-yaml": "^3.12.1",
"json5": "^2.1.0",
"junk": "^2.1.0",
"klaw-sync": "^6.0.0",
"minimatch": "^3.0.4",
"ow": "^0.8.0",
"ow": "^0.12.0",
"xml2js": "^0.4.19",

@@ -46,0 +48,0 @@ "xml2js-parser": "^1.1.1"

@@ -36,2 +36,4 @@ # @absolunet/fss

<br>
<!-- access -->

@@ -42,2 +44,5 @@ ### access

<br>
<!-- appendFile -->

@@ -48,2 +53,5 @@ ### appendFile

<br>
<!-- chmod -->

@@ -54,2 +62,5 @@ ### chmod

<br>
<!-- chown -->

@@ -60,2 +71,5 @@ ### chown

<br>
<!-- close -->

@@ -66,2 +80,5 @@ ### close

<br>
<!-- compressFile -->

@@ -83,2 +100,5 @@ ### compressFile(source *[, destination]*)

<br>
<!-- copy -->

@@ -89,2 +109,5 @@ ### copy

<br>
<!-- copyFile -->

@@ -95,2 +118,5 @@ ### copyFile

<br>
<!-- decompressFile -->

@@ -112,2 +138,5 @@ ### decompressFile(source *[, destination]*)

<br>
<!-- emptyDir -->

@@ -118,2 +147,5 @@ ### emptyDir

<br>
<!-- ensureDir -->

@@ -124,2 +156,5 @@ ### ensureDir

<br>
<!-- ensureFile -->

@@ -130,2 +165,5 @@ ### ensureFile

<br>
<!-- ensureLink -->

@@ -136,2 +174,5 @@ ### ensureLink

<br>
<!-- ensureSymlink -->

@@ -142,2 +183,5 @@ ### ensureSymlink

<br>
<!-- exists -->

@@ -148,2 +192,5 @@ ### exists

<br>
<!-- fchmod -->

@@ -154,2 +201,5 @@ ### fchmod

<br>
<!-- fchown -->

@@ -160,2 +210,5 @@ ### fchown

<br>
<!-- fdatasync -->

@@ -166,2 +219,5 @@ ### fdatasync

<br>
<!-- fstat -->

@@ -172,2 +228,5 @@ ### fstat

<br>
<!-- fsync -->

@@ -178,2 +237,5 @@ ### fsync

<br>
<!-- ftruncate -->

@@ -184,2 +246,5 @@ ### ftruncate

<br>
<!-- futimes -->

@@ -190,2 +255,5 @@ ### futimes

<br>
<!-- lchmod -->

@@ -196,2 +264,5 @@ ### lchmod

<br>
<!-- lchown -->

@@ -202,2 +273,5 @@ ### lchown

<br>
<!-- link -->

@@ -208,2 +282,5 @@ ### link

<br>
<!-- lstat -->

@@ -214,2 +291,5 @@ ### lstat

<br>
<!-- mkdir -->

@@ -220,2 +300,5 @@ ### mkdir

<br>
<!-- mkdirp -->

@@ -226,2 +309,5 @@ ### mkdirp

<br>
<!-- mkdirs -->

@@ -232,2 +318,5 @@ ### mkdirs

<br>
<!-- mkdtemp -->

@@ -238,2 +327,5 @@ ### mkdtemp

<br>
<!-- move -->

@@ -244,2 +336,5 @@ ### move

<br>
<!-- open -->

@@ -250,2 +345,5 @@ ### open

<br>
<!-- outputCompressed -->

@@ -267,2 +365,5 @@ ### outputCompressed(file, content)

<br>
<!-- outputFile -->

@@ -273,2 +374,5 @@ ### outputFile

<br>
<!-- outputJson -->

@@ -297,2 +401,31 @@ ### outputJson(file, object *[, options]*)

<br>
<!-- outputJson5 -->
### outputJson5(file, object *[, options]*)
Almost the same as writeJson5, except that if the directory does not exist, it's created.
#### file
*Required*<br>
Type: `String`<br>
Path of file to write. (If it ends with `.gz` it will be compressed using gzip)
#### object
*Required*<br>
Type: `Object`<br>
Object to write.
#### options.replacer
Type: `Function`<br>
JSON5.stringify [replacer](https://json5.org#json5stringify).
#### options.space
Type: `String` or `Number`<br>
JSON5.stringify [space](https://json5.org#json5stringify).
<br>
<!-- outputXml -->

@@ -317,2 +450,5 @@ ### outputXml(file, object *[, options]*)

<br>
<!-- outputYaml -->

@@ -333,2 +469,5 @@ ### outputYaml(file, object)

<br>
<!-- pathExists -->

@@ -339,2 +478,5 @@ ### pathExists

<br>
<!-- read -->

@@ -345,2 +487,5 @@ ### read

<br>
<!-- readCompressed -->

@@ -357,2 +502,5 @@ ### readCompressed(file)

<br>
<!-- readdir -->

@@ -363,2 +511,5 @@ ### readdir

<br>
<!-- readFile -->

@@ -369,2 +520,5 @@ ### readFile

<br>
<!-- readJson -->

@@ -385,2 +539,23 @@ ### readJson(file *[, reviver]*)

<br>
<!-- readJson5 -->
### readJson5(file *[, reviver]*)
Reads a JSON5 file and then parses it into an object.<br>
Return `Object`
#### file
*Required*<br>
Type: `String`<br>
Path of file to read. (If it ends with `.gz` it will be decompressed using gzip)
#### reviver
Type: `Function`<br>
JSON5.parse [reviver](https://json5.org#json5parse).
<br>
<!-- readlink -->

@@ -391,2 +566,5 @@ ### readlink

<br>
<!-- readXml -->

@@ -407,2 +585,5 @@ ### readXml(file *[, options]*)

<br>
<!-- readYaml -->

@@ -419,2 +600,5 @@ ### readYaml(file)

<br>
<!-- realpath -->

@@ -425,2 +609,5 @@ ### realpath

<br>
<!-- realpath.native -->

@@ -431,2 +618,5 @@ ### realpath.native

<br>
<!-- remove -->

@@ -436,2 +626,5 @@ ### remove

<br>
<!-- rename -->

@@ -442,2 +635,5 @@ ### rename

<br>
<!-- rmdir -->

@@ -448,2 +644,5 @@ ### rmdir

<br>
<!-- scandir -->

@@ -485,2 +684,5 @@ ### scandir(root, type, [options])

<br>
<!-- stat -->

@@ -491,2 +693,5 @@ ### stat

<br>
<!-- symlink -->

@@ -497,2 +702,5 @@ ### symlink

<br>
<!-- truncate -->

@@ -503,2 +711,5 @@ ### truncate

<br>
<!-- unlink -->

@@ -509,2 +720,5 @@ ### unlink

<br>
<!-- utimes -->

@@ -515,2 +729,5 @@ ### utimes

<br>
<!-- write -->

@@ -521,2 +738,5 @@ ### write

<br>
<!-- writeCompressed -->

@@ -537,2 +757,5 @@ ### writeCompressed(file, content)

<br>
<!-- writeFile -->

@@ -543,2 +766,5 @@ ### writeFile

<br>
<!-- writeJson -->

@@ -567,2 +793,31 @@ ### writeJson(file, content *[, options]*)

<br>
<!-- writeJson5 -->
### writeJson5(file, content *[, options]*)
Writes an object to a JSON5 file.
#### file
*Required*<br>
Type: `String`<br>
Path of file to write. (If it ends with `.gz` it will be compressed using gzip)
#### object
*Required*<br>
Type: `Object`<br>
Object to write.
#### options.replacer
Type: `Function`<br>
JSON5.stringify [replacer](https://json5.org#json5stringify).
#### options.space
Type: `String` or `Number`<br>
JSON5.stringify [space](https://json5.org#json5stringify).
<br>
<!-- writeXml -->

@@ -587,2 +842,5 @@ ### writeXml(file, content *[, options]*)

<br>
<!-- writeYaml -->

@@ -604,4 +862,6 @@ ### writeYaml(file, object)

<br>
## License
MIT © [Absolunet](https://absolunet.com)

Sorry, the diff of this file is not supported yet

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