
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@types/ref-struct
Advanced tools
npm install --save @types/ref-struct
This package contains type definitions for ref-struct (https://github.com/TooTallNate/ref-struct).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ref-struct.
// Type definitions for ref-struct
// Project: https://github.com/TooTallNate/ref-struct
// Definitions by: Paul Loyd <https://github.com/loyd>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import ref = require('ref');
/**
* This is the `constructor` of the Struct type that gets returned.
*
* Invoke it with `new` to create a new Buffer instance backing the struct.
* Pass it an existing Buffer instance to use that as the backing buffer.
* Pass in an Object containing the struct fields to auto-populate the
* struct with the data.
*
*/
interface StructType extends ref.Type {
/** Pass it an existing Buffer instance to use that as the backing buffer. */
new (arg: Buffer, data?: {}): any;
new (data?: {}): any;
/** Pass it an existing Buffer instance to use that as the backing buffer. */
(arg: Buffer, data?: {}): any;
(data?: {}): any;
fields: { [key: string]: { type: ref.Type } };
/**
* Adds a new field to the struct instance with the given name and type.
* Note that this function will throw an Error if any instances of the struct
* type have already been created, therefore this function must be called at the
* beginning, before any instances are created.
*/
defineProperty(name: string, type: ref.Type): void;
/**
* Adds a new field to the struct instance with the given name and type.
* Note that this function will throw an Error if any instances of the struct
* type have already been created, therefore this function must be called at the
* beginning, before any instances are created.
*/
defineProperty(name: string, type: string): void;
/**
* Custom for struct type instances.
* @override
*/
toString(): string;
}
/** The struct type meta-constructor. */
declare var StructType: {
new (fields?: object, opt?: object): StructType;
new (fields?: any[]): StructType;
(fields?: object, opt?: object): StructType;
(fields?: any[]): StructType;
}
export = StructType;
These definitions were written by Paul Loyd.
FAQs
TypeScript definitions for ref-struct
The npm package @types/ref-struct receives a total of 562 weekly downloads. As such, @types/ref-struct popularity was classified as not popular.
We found that @types/ref-struct demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.