Socket
Socket
Sign inDemoInstall

cfb

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cfb

Compound File Binary File Format extractor


Version published
Weekly downloads
2.5M
increased by4.34%
Maintainers
1
Weekly downloads
 
Created

What is cfb?

The cfb npm package is a library designed for handling CFB (Compound File Binary) files, also known as Microsoft Compound Document File Format. This format is commonly used in older Microsoft Office documents like .doc, .xls, and .ppt files. The package allows for the creation, manipulation, and extraction of data from these files.

What are cfb's main functionalities?

Reading CFB files

This code demonstrates how to read a CFB file from the filesystem. It uses the `read` method of the cfb package to load a file named 'test.xls' and logs the resulting data structure to the console.

const CFB = require('cfb');
const cfb = CFB.read('test.xls', {type: 'file'});
console.log(cfb);

Creating CFB files

This example shows how to create a new CFB file with a file named 'newfile.txt' inside it. It demonstrates creating a new CFB structure, adding a file to it, and then writing the CFB structure to a file named 'output.cfb'.

const CFB = require('cfb');
const cfb = CFB.utils.cfb_new();
CFB.utils.cfb_add(cfb, 'newfile.txt', new Uint8Array([1, 2, 3, 4, 5]));
CFB.write(cfb, 'output.cfb');

Extracting files from CFB containers

This snippet illustrates how to extract a file from a CFB container. It reads a CFB file named 'container.cfb', searches for a file named '/WordDocument' within the container, and logs its content.

const CFB = require('cfb');
const cfb = CFB.read('container.cfb', {type: 'file'});
const fileContent = CFB.find(cfb, '/WordDocument');
console.log(fileContent);

Other packages similar to cfb

Keywords

FAQs

Package last updated on 08 Jul 2018

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