FileSurgeon

FileSurgeon

new FileSurgeon()

Source:

Methods

(static) asArray()

Static factory method to read the contents of a file as an array

Source:
Returns:

FileSurgeon Promise

Example
import FileSurgeon from 'FileSurgeon';

const contents = FileSurgeon.asArray(file);

(static) asString()

Static factory method to read the contents of a file as a string

Source:
Returns:

FileSurgeon Promise

Example
import FileSurgeon from 'FileSurgeon';

const contents = FileSurgeon.asString(file);

(static) concat()

Static factory method to an array of concatenated file contents

Source:
Returns:

FileSurgeon Promise

Example
import FileSurgeon from 'FileSurgeon';

const contents = FileSurgeon.concat(file1, file2);
console.log(contents);

(static) create()

Deprecated:
  • since version 1.2.0
Source:

(static) edit()

Static factory method to edit existing file contents

Source:
Returns:

StreamEditor

Example
import FileSurgeon from 'FileSurgeon';

const surgeon = FileSurgeon.edit(file);

(static) getLines()

Static factory method get lines from a given file

Source:
Returns:

Promise<String[]>

Example
import FileSurgeon from 'FileSurgeon';

const lines = FileSurgeon.getLines(file, 1, 5, 10);

(static) newFile()

Static factory method create new files

Source:
Returns:

StreamEditor

Example
import FileSurgeon from 'FileSurgeon';

const surgeon = FileSurgeon.newFile(file);

edit()

Deprecated:
  • since version 1.2.0
Source: