multiformats
Advanced tools
Comparing version 13.0.1 to 13.1.0
@@ -14,2 +14,7 @@ import type { CID } from '../cid.js'; | ||
} | ||
/** | ||
* Similar to ByteView but extends ArrayBuffer. | ||
*/ | ||
export interface ArrayBufferView<Data> extends ArrayBuffer, Phantom<Data> { | ||
} | ||
declare const Marker: unique symbol; | ||
@@ -16,0 +21,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import type { ByteView } from '../block/interface.js'; | ||
import type { ArrayBufferView, ByteView } from '../block/interface.js'; | ||
/** | ||
@@ -15,3 +15,3 @@ * IPLD encoder part of the codec. | ||
code: Code; | ||
decode(bytes: ByteView<T>): T; | ||
decode(bytes: ByteView<T> | ArrayBufferView<T>): T; | ||
} | ||
@@ -23,3 +23,3 @@ /** | ||
} | ||
export type { ByteView }; | ||
export type { ArrayBufferView, ByteView }; | ||
//# sourceMappingURL=interface.d.ts.map |
@@ -1,6 +0,6 @@ | ||
import type { ByteView } from './interface.js'; | ||
import type { ArrayBufferView, ByteView } from './interface.js'; | ||
export declare const name = "json"; | ||
export declare const code = 512; | ||
export declare function encode<T>(node: T): ByteView<T>; | ||
export declare function decode<T>(data: ByteView<T>): T; | ||
export declare function decode<T>(data: ByteView<T> | ArrayBufferView<T>): T; | ||
//# sourceMappingURL=json.d.ts.map |
@@ -1,6 +0,6 @@ | ||
import type { ByteView } from './interface.js'; | ||
import type { ArrayBufferView, ByteView } from './interface.js'; | ||
export declare const name = "raw"; | ||
export declare const code = 85; | ||
export declare function encode(node: Uint8Array): ByteView<Uint8Array>; | ||
export declare function decode(data: ByteView<Uint8Array>): Uint8Array; | ||
export declare function decode(data: ByteView<Uint8Array> | ArrayBufferView<Uint8Array>): Uint8Array; | ||
//# sourceMappingURL=raw.d.ts.map |
@@ -84,2 +84,4 @@ { | ||
"./block:encode": "https://multiformats.github.io/js-multiformats/functions/block.encode.html", | ||
"ArrayBufferView": "https://multiformats.github.io/js-multiformats/interfaces/block_interface.ArrayBufferView.html", | ||
"./block/interface:ArrayBufferView": "https://multiformats.github.io/js-multiformats/interfaces/block_interface.ArrayBufferView.html", | ||
"./block/interface:Block": "https://multiformats.github.io/js-multiformats/interfaces/block_interface.Block.html", | ||
@@ -86,0 +88,0 @@ "BlockView": "https://multiformats.github.io/js-multiformats/interfaces/block_interface.BlockView.html", |
{ | ||
"name": "multiformats", | ||
"version": "13.0.1", | ||
"version": "13.1.0", | ||
"description": "Interface for multihash, multicodec, multibase and CID", | ||
@@ -5,0 +5,0 @@ "author": "Mikeal Rogers <mikeal.rogers@gmail.com> (https://www.mikealrogers.com/)", |
@@ -9,2 +9,17 @@ [![multiformats.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://multiformats.io) | ||
<!-- | ||
!IMPORTANT! | ||
Everything in this README between "# About" and "# Install" is automatically | ||
generated and will be overwritten the next time the doc generator is run. | ||
To make changes to this section, please update the @packageDocumentation section | ||
of src/index.js or src/index.ts | ||
To experiment with formatting, please run "npm run docs" from the root of this | ||
repo and examine the changes made. | ||
--> | ||
This library defines common interfaces and low level building blocks for various interrelated multiformat technologies (multicodec, multihash, multibase, and CID). They can be used to implement custom base encoders / decoders / codecs, codec encoders /decoders and multihash hashers that comply to the interface that layers above assume. | ||
@@ -11,0 +26,0 @@ |
@@ -15,2 +15,7 @@ import type { CID } from '../cid.js' | ||
/** | ||
* Similar to ByteView but extends ArrayBuffer. | ||
*/ | ||
export interface ArrayBufferView<Data> extends ArrayBuffer, Phantom<Data> {} | ||
declare const Marker: unique symbol | ||
@@ -17,0 +22,0 @@ |
@@ -1,2 +0,2 @@ | ||
import type { ByteView } from '../block/interface.js' | ||
import type { ArrayBufferView, ByteView } from '../block/interface.js' | ||
@@ -17,3 +17,3 @@ /** | ||
code: Code | ||
decode(bytes: ByteView<T>): T | ||
decode(bytes: ByteView<T> | ArrayBufferView<T>): T | ||
} | ||
@@ -26,2 +26,2 @@ | ||
export type { ByteView } | ||
export type { ArrayBufferView, ByteView } |
@@ -1,2 +0,2 @@ | ||
import type { ByteView } from './interface.js' | ||
import type { ArrayBufferView, ByteView } from './interface.js' | ||
@@ -13,4 +13,4 @@ const textEncoder = new TextEncoder() | ||
export function decode <T> (data: ByteView<T>): T { | ||
export function decode <T> (data: ByteView<T> | ArrayBufferView<T>): T { | ||
return JSON.parse(textDecoder.decode(data)) | ||
} |
import { coerce } from '../bytes.js' | ||
import type { ByteView } from './interface.js' | ||
import type { ArrayBufferView, ByteView } from './interface.js' | ||
@@ -11,4 +11,4 @@ export const name = 'raw' | ||
export function decode (data: ByteView<Uint8Array>): Uint8Array { | ||
export function decode (data: ByteView<Uint8Array> | ArrayBufferView<Uint8Array>): Uint8Array { | ||
return coerce(data) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
321702
4988
250