@blackglory/refile-js
TypeScript icon, indicating that this package has built-in type declarations

0.15.2 • Public • Published

refile-js

Install

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

API

getFileHash

function getFileHash(blobOrFilename: Blob | string): Promise<string>

RefileClient

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>
}

Readme

Keywords

none

Package Sidebar

Install

npm i @blackglory/refile-js

Weekly Downloads

65

Version

0.15.2

License

MIT

Unpacked Size

34.1 kB

Total Files

39

Last publish

Collaborators

  • black_glory