# @blackglory/refile-js

> ```sh npm install --save @blackglory/refile-js # or yarn add @blackglory/refile-js ```

Latest version **0.15.4** (published 2026-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @blackglory/refile-js
pnpm add @blackglory/refile-js
yarn add @blackglory/refile-js
bun add @blackglory/refile-js
```

## Health

**Score 60/100 (C)** — status: active.

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

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.15.4 |
| Published | 2026-05-23 |
| First published | 2021-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 9 |
| Unpacked size | 33.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | BlackGlory |
| Maintainers | black_glory |

## Links

- npm: https://www.npmjs.com/package/@blackglory/refile-js
- Repository: https://github.com/BlackGlory/refile-js
- Homepage: https://github.com/BlackGlory/refile-js#readme
- Issues: https://github.com/BlackGlory/refile-js/issues
- npm.io page: https://npm.io/package/@blackglory/refile-js

## Dependencies (9)

- [split-hash](https://npm.io/package/split-hash.md) ^0.3.1
- [extra-abort](https://npm.io/package/extra-abort.md) ^0.3.4
- [extra-fetch](https://npm.io/package/extra-fetch.md) ^4.0.5
- [extra-request](https://npm.io/package/extra-request.md) ^8.4.0
- [extra-response](https://npm.io/package/extra-response.md) ^0.5.1
- [extra-compatible](https://npm.io/package/extra-compatible.md) ^0.2.0
- [iterable-operator](https://npm.io/package/iterable-operator.md) ^4.0.5
- [@blackglory/prelude](https://npm.io/package/@blackglory/prelude.md) ^0.3.1
- [@blackglory/http-status](https://npm.io/package/@blackglory/http-status.md) ^2.0.1

## Recent versions

- 0.15.4 (latest) — 2026-05-23
- 0.15.3 — 2026-04-20
- 0.15.2 — 2023-06-11
- 0.15.1 — 2023-03-28
- 0.15.0 — 2023-02-09
- 0.14.0 — 2023-02-09
- 0.13.1 — 2023-01-30
- 0.13.0 — 2023-01-20
- 0.12.0 — 2022-12-01
- 0.11.3 — 2022-11-02
- 0.11.2 — 2022-10-23
- 0.11.1 — 2022-10-21
- 0.11.0 — 2022-10-21
- 0.10.6 — 2022-10-21
- 0.10.5 — 2022-10-20
- … 51 more at https://npm.io/package/@blackglory/refile-js/versions

## README

# refile-js
## Install
```sh
npm install --save @blackglory/refile-js
# or
yarn add @blackglory/refile-js
```

## API
### getFileHash
```ts
function getFileHash(blobOrFilename: Blob | string): Promise<string>
```

### RefileClient
```ts
interface IFileInfo {
  hash: string
  location: string | null
  references: number
}

interface IRefileClientOptions {
  server: string
  basicAuth?: {
    username: string
    password: string
  }
  keepalive?: boolean
  timeout?: number
}

interface IRefileClientRequestOptions {
  signal?: AbortSignal
  keepalive?: boolean
  timeout?: number | false
}

class RefileClient {
  constructor(options: IRefileClientOptions)

  uploadFile(
    blobOrFilename: Blob | string
  , options?: IRefileClientRequestOptions
  ): Promise<void>

  getFileInfo(hash: string, options?: IRefileClientRequestOptions): Promise<IFileInfo>

  getFileLocation(
    hash: string
  , options?: IRefileClientRequestOptions
  ): Promise<string | undefined>

  setReference(
    namespace: string
  , itemId: string
  , fileHash: string
  , options?: IRefileClientRequestOptions
  ): Promise<void>

  removeReference(
    namespace: string
  , itemId: string
  , fileHash: string
  , options?: IRefileClientRequestOptions
  ): Promise<void>

  removeReferencesByItemId(
    namespace: string
  , itemId: string
  , options?: IRefileClientRequestOptions
  ): Promise<void>

  removeReferencesByNamespace(
    namespace: string
  , options?: IRefileClientRequestOptions
  ): Promise<void>

  getAllNamespaces(options?: IRefileClientRequestOptions): Promise<string[]>

  getAllItemIds(namespace: string, options?: IRefileClientRequestOptions): Promise<string[]>

  getFileHashesByItemId(
    namespace: string
  , itemId: string
  , options?: IRefileClientRequestOptions
  ): Promise<string[]>

  getItemIdsByFileHash(
    fileHash: string
  , namespace: string
  , options?: IRefileClientRequestOptions
  ): Promise<string[]>

  collectGarbage(options?: IRefileClientRequestOptions): Promise<void>
}
```

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