SheetJS / js-cfb

:floppy_disk: OLE File Container Format
https://sheetjs.com/cfb-editor
Apache License 2.0
69 stars 15 forks source link

TypeError: file.slice is not a function #20

Open serkonda7 opened 1 year ago

serkonda7 commented 1 year ago
.../node_modules/cfb/cfb.js:370
var blob = file.slice(0,512);
                ^

TypeError: file.slice is not a function
    at parse (.../node_modules/cfb/cfb.js:370:17)
    at Object.read (.../node_modules/cfb/cfb.js:688:9)

My code is this:

const cfb = CFB.read(file, { type: 'file' })
    // const cfb = CFB.parse(data)
    const vbaDirEntry = CFB.find(cfb, 'VBA')
    if (!vbaDirEntry) {
        throw new Error('VBA root not found')
    }

    const vbaDir = CFB.read(cfb, vbaDirEntry)
    const modules = {}
    for (const entry of vbaDir.FullPaths) {
        console.log(entry)
    }