Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aggregion/agg-bundle

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aggregion/agg-bundle

Node.js module for reading and creating Aggregion binary bundles

  • 1.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
5
Weekly downloads
 
Created
Source

Node.js module for reading and creating Aggregion binary bundles

Installation

npm install git+ssh://git@stash.aggregion.com:7999/bck/node-bundle-module.git --save

Usage

const AggregionBundle = require('agg-bundle');

// Create an instance

let bundle = new AggregionBundle({path: '/path/to/bundle'});

// Get list of files

bundle
    .getFiles()
    .then((fileNames) => {
        console.log(fileNames);
    });

// Get bundle info

bundle
    .getBundleInfoData()
    .then((data) => {
        console.log('info', data);
    });

// Get bundle properties

bundle
    .getBundlePropertiesData()
    .then((data) => {
        console.log('properties', data);
    });

// Set bundle info

bundle
    .setBundleInfoData('some info string')
    .then(() => {
        return bundle.setBundleInfoData(new Buffer('or you can use buffer'));
    })
    .then(() => {
        console.log('done');
    });

// Set bundle properties

bundle
    .setBundlePropertiesData('some info string')
    .then(() => {
        return bundle.setBundlePropertiesData(new Buffer('or you can use buffer'));
    })
    .then(() => {
        console.log('done');
    });

// Create new file

bundle
    .createFile('path/to/file/to/create.dat')
    .then((fd) => {
        console.log(`created file with descriptor: ${fd}`);
    });

// Open existing file

bundle
    .openFile('path/to/existing/file.dat')
    .then((fd) => {
        console.log(`opened file with descriptor: ${fd}`);
    });

// Read file

bundle
    .readFileBlock(bundle.openFile('path/to/existing/file.dat'), 1024 * 1024)
    .then((data) => {
        console.log(`Read block with size: ${data.length}`);
    });

// Read file properties

bundle
    .readFilePropertiesData(bundle.openFile('path/to/existing/file.dat'))
    .then((propsData) => {
        console.log(propsData);
    });

// Seek

let fd = bundle.openFile('path/to/existing/file.dat');


bundle.seekFile(
    fd, 
    1000 // Position from begin
);

// Write file

bundle
    .createFile('path/to/file/to/create.dat')
    .then((fd) => {
        return bundle.writeFileBlock(fd, new Buffer(1000))
    })
    .then(() => {
        console.log('Block written');
    });

// Write file properties

bundle
    .writeFilePropertiesData(bundle.openFile('path/to/existing/file.dat'), 'some props')
    .then(() => {
        console.log('Properties written');
    });

// Get file size

console.log(`Size of file: ${bundle.getFileSize('path/to/existing/file.dat')}`);

// Delete file

bundle.deleteFile('path/to/existing/file.dat');

Run tests

npm test

FAQs

Package last updated on 05 Feb 2021

Did you know?

Socket

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.

Install

Related posts

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