Socket
Socket
Sign inDemoInstall

@hazae41/binary

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hazae41/binary - npm Package Compare versions

Comparing version 1.2.27 to 1.2.28

dist/cjs/mods/binary/errors.cjs

5

dist/types/index.d.ts
import * as index from './mods/index.js';
export { index as Binary };
export { Empty } from './mods/binary/empty.js';
export { BinaryError, BinaryReadError, BinaryWriteError, CursorReadLengthUnderflowError, CursorWriteLenghtUnderflowError } from './mods/binary/errors.js';
export { Opaque, SafeOpaque, UnsafeOpaque } from './mods/binary/opaque.js';
export { BinaryReadError, BinaryReadUnderflowError, Readable } from './mods/binary/readable.js';
export { BinaryWriteError, BinaryWriteUnderflowError, Writable } from './mods/binary/writable.js';
export { Readable } from './mods/binary/readable.js';
export { Writable } from './mods/binary/writable.js';

31

dist/types/mods/binary/opaque.d.ts
import { Bytes, Sized } from '@hazae41/bytes';
import { Cursor, CursorWriteLengthOverflowError, CursorReadLengthOverflowError } from '@hazae41/cursor';
import { Result } from '@hazae41/result';
import { Readable, BinaryReadUnderflowError } from './readable.js';
import { Writable, BinaryWriteUnderflowError } from './writable.js';
import { Readable } from './readable.js';
import { CursorReadLengthUnderflowError, CursorWriteLenghtUnderflowError } from './errors.js';
import { Writable } from './writable.js';

@@ -28,3 +29,3 @@ declare class Opaque<T extends Bytes = Bytes> {

*/
tryInto<T extends Readable>(readable: T): Result<Readable.ReadOutput<T>, Readable.ReadError<T> | BinaryReadUnderflowError>;
tryInto<T extends Readable>(readable: T): Result<Readable.ReadOutput<T>, Readable.ReadError<T> | CursorReadLengthUnderflowError>;
/**

@@ -35,3 +36,3 @@ * Create an opaque from a binary data type

*/
static tryFrom<T extends Writable>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | BinaryWriteUnderflowError>;
static tryFrom<T extends Writable>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | CursorWriteLenghtUnderflowError>;
}

@@ -42,3 +43,14 @@ /**

declare namespace UnsafeOpaque {
/**
* Unsafe zero-copy read remaining bytes from cursor
* @param cursor
* @returns
*/
function tryRead(cursor: Cursor): Result<Opaque, CursorReadLengthOverflowError>;
/**
* Perform unsafe zero-copy conversion to `Opaque` if `T instanceof Opaque`, else use `Opaque.tryFrom`
* @param writable
* @returns
*/
function tryFrom<T extends Writable>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | CursorWriteLenghtUnderflowError>;
}

@@ -49,5 +61,16 @@ /**

declare namespace SafeOpaque {
/**
* Safe copy read remaining bytes from cursor
* @param cursor
* @returns
*/
function tryRead(cursor: Cursor): Result<Opaque, CursorReadLengthOverflowError>;
/**
* Perform safe, copy conversion to `Opaque` using `Opaque.tryFrom`
* @param writable
* @returns
*/
function tryFrom<T extends Writable>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | CursorWriteLenghtUnderflowError>;
}
export { Opaque, SafeOpaque, UnsafeOpaque };
import { Bytes } from '@hazae41/bytes';
import { CursorReadError, Cursor } from '@hazae41/cursor';
import { Cursor } from '@hazae41/cursor';
import { Result } from '@hazae41/result';
import { CursorReadLengthUnderflowError } from './errors.js';
type BinaryReadError = BinaryReadUnderflowError | CursorReadError;
declare class BinaryReadUnderflowError extends Error {
#private;
readonly cursor: Cursor;
constructor(cursor: Cursor);
}
/**

@@ -41,5 +36,5 @@ * A readable binary data type

*/
function tryReadFromBytes<T extends Readable>(readable: T, bytes: Bytes): Result<ReadOutput<T>, ReadError<T> | BinaryReadUnderflowError>;
function tryReadFromBytes<T extends Readable>(readable: T, bytes: Bytes): Result<ReadOutput<T>, ReadError<T> | CursorReadLengthUnderflowError>;
}
export { BinaryReadError, BinaryReadUnderflowError, Readable };
export { Readable };
import { Bytes } from '@hazae41/bytes';
import { CursorWriteError, Cursor } from '@hazae41/cursor';
import { Cursor } from '@hazae41/cursor';
import { Result } from '@hazae41/result';
import { CursorWriteLenghtUnderflowError } from './errors.js';
type BinaryWriteError = BinaryWriteUnderflowError | CursorWriteError;
declare class BinaryWriteUnderflowError extends Error {
#private;
readonly cursor: Cursor;
constructor(cursor: Cursor);
}
/**

@@ -35,5 +30,5 @@ * A writable binary data type

*/
function tryWriteToBytes<T extends Writable>(writable: T): Result<Bytes, SizeError<T> | WriteError<T> | BinaryWriteUnderflowError>;
function tryWriteToBytes<T extends Writable>(writable: T): Result<Bytes, SizeError<T> | WriteError<T> | CursorWriteLenghtUnderflowError>;
}
export { BinaryWriteError, BinaryWriteUnderflowError, Writable };
export { Writable };
export { Empty } from './binary/empty.js';
export { BinaryError, BinaryReadError, BinaryWriteError, CursorReadLengthUnderflowError, CursorWriteLenghtUnderflowError } from './binary/errors.js';
export { Opaque, SafeOpaque, UnsafeOpaque } from './binary/opaque.js';
export { BinaryReadError, BinaryReadUnderflowError, Readable } from './binary/readable.js';
export { BinaryWriteError, BinaryWriteUnderflowError, Writable } from './binary/writable.js';
export { Readable } from './binary/readable.js';
export { Writable } from './binary/writable.js';
{
"type": "module",
"name": "@hazae41/binary",
"version": "1.2.27",
"version": "1.2.28",
"description": "Zero-copy binary data types",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/hazae41/binary",

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

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

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc