Skip to content

Ikagaka/NarLoader

Repository files navigation

NarLoader - Nanika ARchive Loader

Greenkeeper badge

Nanika ARchive (*.nar) loader

Installation

npm install narloader

Usage

import * as NarLoader from "narloader";
const buffer = (nar data ArrayBuffer);
NarLoader.loadFromBuffer(buffer).then((directory) => ...);

on browser

You can bundle NarLoader by webpack / browserify with BrowserFS' instruction.

API

/**
 * load nar from path
 * @param narPath nar file path
 */
export async function loadFromPath(narPath: string): Promise<NanikaContainerSyncDirectory>;

/**
 * load nar from URI
 * @param narUri nar file URI
 */
export async function loadFromURI(narUri: URL | string): Promise<NanikaContainerSyncDirectory>;

/**
 * load nar from buffer
 * @param nar nar file buffer
 */
export async function loadFromBuffer(nar: string | ArrayBuffer | Uint8Array | Buffer | Blob): Promise<NanikaContainerSyncDirectory>;

License

This is released under MIT License.