You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To my understanding, it seams that the objects created by b4a.from() don't expose the same signatures as nodejs Buffer leading to potentially non-crossplatform code.
I have no bulletproof idea on how to fix it, however, I wonder if attempting to inject methods to the javascript TypedArray prototype, could deliver a clean solution.
Works on NodeJS, but doesn't on browser.
constb4a=require('b4a')constbuf=b4a.from('a lot of binary data coming from tar file')constUSTAR_MAGIC=b4a.from('ustar\x00')if(USTAR_MAGIC.compare(buf,MAGIC_OFFSET,MAGIC_OFFSET+6)===0){console.log("eureka!")}
constb4a=require('b4a')constbuf=b4a.from('a lot of binary data coming from tar file')constUSTAR_MAGIC=b4a.from('ustar\x00')constmagicBuf=newb4a.alloc(6,0,'hex')b4a.copy(buf,magicBuf,0,MAGIC_OFFSET,MAGIC_OFFSET+6)if(b4a.compare(USTAR_MAGIC,magicBuf)===0){console.log("eureka!")}
To my understanding, it seams that the objects created by b4a.from() don't expose the same signatures as nodejs Buffer leading to potentially non-crossplatform code.
I have no bulletproof idea on how to fix it, however, I wonder if attempting to inject methods to the javascript TypedArray prototype, could deliver a clean solution.
Works on NodeJS, but doesn't on browser.
src: https://github.com/mafintosh/tar-stream/blob/ca0e270f11dc61f507f7972e53071b8fa99e66bf/headers.js#L265
Works on browser.
src: https://github.com/cesare-montresor/tar-stream/blob/628855745845fdd3a13d9d99f47253df70223331/headers.js#L265
The text was updated successfully, but these errors were encountered: