# file-access

> Easily fetch local or remote file, and return buffer data.

Latest version **1.1.2** (published 2023-12-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install file-access
pnpm add file-access
yarn add file-access
bun add file-access
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2023-12-26 |
| First published | 2023-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mervin |
| Maintainers | mengqing723 |
| Keywords | access-file, fetch-file, readFile, readFileSync, buffer |

## Links

- npm: https://www.npmjs.com/package/file-access
- Repository: https://github.com/mengqing723/file-access
- Homepage: https://github.com/mengqing723/file-access#readme
- Issues: https://github.com/mengqing723/file-access/issues
- npm.io page: https://npm.io/package/file-access

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2023-12-26
- 1.1.1 — 2023-12-26
- 1.1.0 — 2023-12-17
- 1.0.0 — 2023-12-14

## README

# file-access

[![version](https://img.shields.io/npm/v/file-access?style=flat-square)](https://www.npmjs.com/package/file-access)
[![Codecov](https://img.shields.io/codecov/c/github/meqn/file-access?token=1498G3HFKJ&style=flat-square&logo=codecov)](https://codecov.io/gh/Meqn/file-access)
[![release](https://img.shields.io/github/actions/workflow/status/meqn/file-access/release.yml?style=flat-square)](https://github.com/Meqn/pipflow/releases)
[![node.js](https://img.shields.io/node/v/file-access?style=flat-square&logo=nodedotjs)](https://nodejs.org/en/about/releases/)
[![languages](https://img.shields.io/github/languages/top/meqn/file-access?style=flat-square)](https://github.com/Meqn/file-access)



Easily fetch local or remote file, and return buffer data.

> Not suitable for accessing large files

轻松获取本地或远程文件, 并返回buffer数据。(不适用于大文件)


## Usage

```js
const {
  accessFile,
  accessLocalFileSync
} = require('file-access');


accessFile('/path/to/local.txt', (err, data) => {
  // ...
})

accessFile('https://example.com/file.zip').then((data) => {
  // ...
  console.log('file size : ', data.byteLength)
  conosle.log('content-type :', data.contentType)
})

const buffer = accessLocalFileSync('/path/to/local.txt')
```

---
_Source: https://npm.io/package/file-access · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
