How to use the cfb.write function in cfb

To help you get started, we’ve selected a few cfb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dtjohnson / xlsx-populate / lib / Encryptor.js View on Github external
// Build the encryption info buffer
        const encryptionInfoBuffer = this._buildEncryptionInfo(encryptionInfo);

        // Create a new CFB
        let output = cfb.utils.cfb_new();

        // Add the encryption info and encrypted package
        cfb.utils.cfb_add(output, "EncryptionInfo", encryptionInfoBuffer);
        cfb.utils.cfb_add(output, "EncryptedPackage", encryptedPackage);

        // Delete the SheetJS entry that is added at initialization
        cfb.utils.cfb_del(output, "\u0001Sh33tJ5");

        // Write to a buffer and return
        output = cfb.write(output);

        // The cfb library writes to a Uint8array in the browser. Convert to a Buffer.
        if (!Buffer.isBuffer(output)) output = Buffer.from(output);

        return output;
    }

cfb

Compound File Binary File Format extractor

Apache-2.0
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis