# @util.js/node-files

> JavaScript Node.js utility methods for files

Latest version **0.41.3** (published 2023-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @util.js/node-files
pnpm add @util.js/node-files
yarn add @util.js/node-files
bun add @util.js/node-files
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.41.3 |
| Published | 2023-04-23 |
| First published | 2020-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 54.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Chris Topher |
| Maintainers | creemama |
| Keywords | file, file system, files, node, utilities, utility, utiljs |

## Links

- npm: https://www.npmjs.com/package/@util.js/node-files
- Repository: https://github.com/creemama/utiljs.git#master
- Homepage: https://github.com/creemama/utiljs/tree/master#readme
- Issues: https://github.com/creemama/utiljs/issues
- npm.io page: https://npm.io/package/@util.js/node-files

## Dependencies (10)

- [ncp](https://npm.io/package/ncp.md) 2.0.0
- [touch](https://npm.io/package/touch.md) 3.1.0
- [mkdirp](https://npm.io/package/mkdirp.md) 3.0.0
- [rimraf](https://npm.io/package/rimraf.md) 5.0.0
- [graceful-fs](https://npm.io/package/graceful-fs.md) 4.2.11
- [read-last-lines](https://npm.io/package/read-last-lines.md) 1.8.0
- [@util.js/objects](https://npm.io/package/@util.js/objects.md) 0.41.3
- [@util.js/strings](https://npm.io/package/@util.js/strings.md) 0.41.3
- [@util.js/promises](https://npm.io/package/@util.js/promises.md) 0.41.3
- [sanitize-filename](https://npm.io/package/sanitize-filename.md) 1.6.3

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.41.3 (latest) — 2023-04-23
- 0.41.2 — 2022-11-27
- 0.41.1 — 2021-11-08
- 0.41.0 — 2021-05-08
- 0.40.1 — 2020-11-15
- 0.40.0 — 2020-11-15

## README

# @util.js/node-files

> JavaScript Node.js utility methods for files

<p>
  <a href="https://www.npmjs.com/package/@util.js/node-files"><img alt="NPM Status" src="https://img.shields.io/npm/v/@util.js/node-files.svg?style=flat"></a>
  <a href="https://travis-ci.org/creemama/utiljs"><img alt="Travis CI Build Status" src="https://img.shields.io/travis/creemama/utiljs/master.svg?style=flat-square&label=Travis+CI"></a>
</p>

@util.js/node-files is part of [Util.js](https://github.com/creemama/utiljs).

This class contains all the methods of [fs](https://nodejs.org/api/fs.html) and [path](https://nodejs.org/api/path.html) in addition to:

- cpr
- diff
- filesWithExtension
- filesWithExtensionSync
- isDirectory
- isDirectorySync
- isFile
- isFileSync
- mkdirp
- mkdirpSync
- readFiles
- readLastLines
- rmrf
- rmrfSync
- sanitizeFilename
- touch
  <a name="module_Files"></a>

## Files

<a name="module_Files+readLastLines"></a>

### files.readLastLines(path, maxLineCount, [encoding], [callback]) ⇒ <code>Promise</code> \| <code>undefined</code>

Reads in the last `n` lines of a file.

This function just delegates to https://github.com/alexbbt/read-last-lines .

**Kind**: instance method of [<code>Files</code>](#module_Files)  
**Returns**: <code>Promise</code> \| <code>undefined</code> - a `Promise` that resolves with the lines (as a
`String` or a `Buffer`) or rejects with an error or `undefined` if a
`callback` is specified

| Param        | Type                                                           | Default                       | Description                                                             |
| ------------ | -------------------------------------------------------------- | ----------------------------- | ----------------------------------------------------------------------- |
| path         | <code>Buffer</code> \| <code>String</code> \| <code>URL</code> |                               | absolute or relative path to a file; `URL`s must use the file:// scheme |
| maxLineCount | <code>Number</code>                                            |                               | max number of lines to read                                             |
| [encoding]   | <code>String</code>                                            | <code>&quot;utf8&quot;</code> | specifies the character encoding to use or `"buffer"`                   |
| [callback]   | <code>function</code>                                          |                               | an optional callback                                                    |

---
_Source: https://npm.io/package/@util.js/node-files · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
