0.0.29 • Published 7 years ago

serialfs v0.0.29

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
7 years ago

creates an object / string representation of files and folders

usage

const serialfs = require('serialfs');

// callback style
serialfs.obj('subfolder', (err, res) => {
    console.log(res);}); // {"file1": "contents", "file2": "contents"}

serialfs.obj('subfolder', {should_read_file_contents: false}, (err, res) => {
    console.log(res);}); // {"file1": "", "file2":""}

serialfs.yaml('subfolder', (err, res) => {
    console.log(res);}); // "file1: '' \nfile2: ''"

// promise style
serialfs.obj('subfolder').then((res) => {
    console.log(res);}).catch((err) => true);

options

the second parameter is the options object. specify behvior with the following:

should_recurse

if this is true, will recurse into all subfolders\ if this is false, will not recurse into any subfolders\ if this is an object, will look for the current folder's name

  • if found, will recurse into the folder in the object and the file system and repeat
  • if not found, will recurse into the folder

should_read_file_contents

if this is true, will read the contents of the files\ if this is false, will not read the contents of the files\ if this is an object, will look for the current folder's name

  • if found, will recurse into the folder in the object and the file system and repeat
  • if not found, will recurse into the folder

example

if the file structure is:

{a: {b: 'text1', c: 'text2'}, d: {e: 'text3:, f: 'text4'}}

the recurse object is:

{a: {b: true}}

and the read file object is:

{a: {d: false}}

the result would be:

{a: {b: 'text1', c: ''}, d: null}

should_print_debug

will send extra information to standard out, to help understand what's happening

installation

npm install --save serialfs
0.0.29

7 years ago

0.0.28

7 years ago

0.0.27

7 years ago

0.0.26

7 years ago

0.0.25

7 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago