All Projects → SheetJS → js-cfb

SheetJS / js-cfb

Licence: Apache-2.0 license
💾 OLE File Container Format

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
Makefile
30231 projects

Projects that are alternatives of or similar to js-cfb

PSDiskPart
DiskPart PowerShell Module
Stars: ✭ 30 (-44.44%)
Mutual labels:  storage
esop
Cloud-enabled backup and restore tool for Apache Cassandra
Stars: ✭ 40 (-25.93%)
Mutual labels:  storage
CodablePersist
Store and Cache Anything Codable
Stars: ✭ 18 (-66.67%)
Mutual labels:  storage
space-client
File Upload (encrypted), File Sharing, Filecoin Markets (TBD), and User Controlled Data. You can access same methods from the Space Daemon using our JS client, so you don't need to worry about gRPC calls.
Stars: ✭ 73 (+35.19%)
Mutual labels:  storage
nestjs-throttler-storage-redis
Redis storage provider for the nestjs-throttler package.
Stars: ✭ 56 (+3.7%)
Mutual labels:  storage
go-storage
A vendor-neutral storage library for Golang: Write once, run on every storage service.
Stars: ✭ 387 (+616.67%)
Mutual labels:  storage
mmtf
The specification of the MMTF format for biological structures
Stars: ✭ 40 (-25.93%)
Mutual labels:  file-format
spreadsheet
Yii2 extension for export to Excel
Stars: ✭ 79 (+46.3%)
Mutual labels:  xls
cockpit-gluster
Easy to use management console for Gluster Storage with glusterd2 support.
Stars: ✭ 29 (-46.3%)
Mutual labels:  storage
go-obj
OBJ file loader for golang
Stars: ✭ 16 (-70.37%)
Mutual labels:  file-format
CHKV
Consistent Hashing based Key-Value Memory Storage
Stars: ✭ 20 (-62.96%)
Mutual labels:  storage
GbxDump
A Microsoft Windows application that displays the contents of the file header of *.Gbx files used by the Nadeo game engine GameBox.
Stars: ✭ 19 (-64.81%)
Mutual labels:  file-format
eec
A fast and lower memory excel write/read tool.一个非POI底层,支持流式处理的高效且超低内存的Excel读写工具
Stars: ✭ 93 (+72.22%)
Mutual labels:  xls
jiva-operator
Kubernetes Operator for managing Jiva Volumes via custom resource.
Stars: ✭ 31 (-42.59%)
Mutual labels:  storage
xd-storage-helper
A little helper to make storing key-value-pairs (e.g. settings) for Adobe XD plugins easier.
Stars: ✭ 22 (-59.26%)
Mutual labels:  storage
msbotframework-mongo-middlelayer
Microsoft Bot framework: Using MongoDB as storage for conversational states, data and context
Stars: ✭ 36 (-33.33%)
Mutual labels:  storage
h5webstorage
Web Storage for Angular 2
Stars: ✭ 38 (-29.63%)
Mutual labels:  storage
miniply
A fast and easy-to-use PLY parsing library in a single c++11 header and cpp file
Stars: ✭ 29 (-46.3%)
Mutual labels:  file-format
MagicaVoxel File Writer
MagicaVoxel File Writer dependency free cpp class
Stars: ✭ 26 (-51.85%)
Mutual labels:  file-format
KVStorage
Android 结构化KV存储框架,基于 yaml 生成 java 结构化存储类
Stars: ✭ 228 (+322.22%)
Mutual labels:  storage

Container File Blobs

Pure JS implementation of various container file formats, including ZIP and CFB.

Build Status Coverage Status Dependencies Status NPM Downloads Analytics

Installation

In the browser:

<script src="dist/cfb.min.js" type="text/javascript"></script>

With npm:

$ npm install cfb

The xlscfb.js file is designed to be embedded in js-xlsx

Library Usage

In node:

var CFB = require('cfb');

For example, to get the Workbook content from an Excel 2003 XLS file:

var cfb = CFB.read(filename, {type: 'file'});
var workbook = CFB.find(cfb, 'Workbook');
var data = workbook.content;

Command-Line Utility Usage

The cfb-cli module ships with a CLI tool for manipulating and inspecting supported files.

JS API

TypeScript definitions are maintained in types/index.d.ts.

The CFB object exposes the following methods and properties:

CFB.parse(blob) takes a nodejs Buffer or an array of bytes and returns an parsed representation of the data.

CFB.read(blob, opts) wraps parse.

CFB.find(cfb, path) performs a case-insensitive match for the path (or file name, if there are no slashes) and returns an entry object or null if not found.

CFB.write(cfb, opts) generates a file based on the container.

CFB.writeFile(cfb, filename, opts) creates a file with the specified name.

Parse Options

CFB.read takes an options argument. opts.type controls the behavior:

type expected input
"base64" string: Base64 encoding of the file
"binary" string: binary string (byte n is data.charCodeAt(n))
"buffer" nodejs Buffer
"file" string: path of file that will be read (nodejs only)
(default) buffer or array of 8-bit unsigned int (byte n is data[n])

Write Options

CFB.write and CFB.writeFile take options argument.

opts.type controls the behavior:

type output
"base64" string: Base64 encoding of the file
"binary" string: binary string (byte n is data.charCodeAt(n))
"buffer" nodejs Buffer
"file" string: path of file that will be created (nodejs only)
(default) buffer if available, array of 8-bit unsigned int otherwise

opts.fileType controls the output file type:

fileType output
'cfb' (default) CFB container
'zip' ZIP file
'mad' MIME aggregate document

opts.compression enables DEFLATE compression for ZIP file type.

Utility Functions

The utility functions are available in the CFB.utils object. Functions that accept a name argument strictly deal with absolute file names:

  • .cfb_new(?opts) creates a new container object.
  • .cfb_add(cfb, name, ?content, ?opts) adds a new file to the cfb. Set the option {unsafe:true} to skip existence checks (for bulk additions)
  • .cfb_del(cfb, name) deletes the specified file
  • .cfb_mov(cfb, old_name, new_name) moves the old file to new path and name
  • .use_zlib(require("zlib")) loads a nodejs zlib instance.

By default, the library uses a pure JS inflate/deflate implementation. NodeJS zlib.InflateRaw exposes the number of bytes read in versions after 8.11.0. If a supplied zlib does not support the required features, a warning will be displayed in the console and the pure JS fallback will be used.

Container Object Description

The objects returned by parse and read have the following properties:

  • .FullPaths is an array of the names of all of the streams (files) and storages (directories) in the container. The paths are properly prefixed from the root entry (so the entries are unique)

  • .FileIndex is an array, in the same order as .FullPaths, whose values are objects following the schema:

interface CFBEntry {
  name: string; /** Case-sensitive internal name */
  type: number; /** 1 = dir, 2 = file, 5 = root ; see [MS-CFB] 2.6.1 */
  content: Buffer | number[] | Uint8Array; /** Raw Content */
  ct?: Date; /** Creation Time */
  mt?: Date; /** Modification Time */
  ctype?: String; /** Content-Type (for MAD) */
}

License

Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 License are reserved by the Original Author.

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].