![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
construct-js
Advanced tools
`construct-js` is a library for creating byte level data structures. It focuses on a declarative API and simplicity of use.
construct-js
is a library for creating byte level data structures. It focuses on a declarative API and simplicity of use.
The following example builds a completely valid zip archive with one file inside - helloworld.txt
.
const fs = require('fs');
const {
RawString,
Word,
DoubleWord,
Struct,
} = require('construct-js');
const data = RawString('helloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworld');
const filename = RawString('helloworld.txt');
const sharedHeaderInfo = Struct('sharedHeaderInfo')
.field('minVersion', Word(10))
.field('gpFlag', Word(0))
.field('compressionMethod', Word(0))
.field('lastModifiedTime', Word(0))
.field('lastModifiedDate', Word(0))
.field('crc32', DoubleWord(0))
.field('compressedSized', DoubleWord(data.byteLength))
.field('uncompressedSized', DoubleWord(data.byteLength))
.field('filenameSize', Word(filename.byteLength))
.field('extraFieldLength', Word(0));
const localHeader = Struct('localHeader')
.field('header', DoubleWord(0x04034b50))
.field('sharedHeaderInfo', sharedHeaderInfo)
.field('filename', filename);
const centralDirectory = Struct('centralDirectory')
.field('header', DoubleWord(0x02014b50))
.field('madeByVersion', Word(10))
.field('sharedHeaderInfo', sharedHeaderInfo)
.field('fileCommentSize', Word(0))
.field('diskNumber', Word(0))
.field('internalFileAttributes', Word(0))
.field('externalFileAttributes', DoubleWord(0))
.field('relativeOffset', DoubleWord(0))
.field('filename', filename);
const endOfCentralDirectory = Struct('endOfCentralDirectory')
.field('header', DoubleWord(0x06054b50))
.field('diskNumber', Word(0))
.field('centralDirDiskStart', Word(0))
.field('numberOfCentralDirsOnDisk', Word(1))
.field('totalNumberOfCentralDirs', Word(1))
.field('centralDirSize', DoubleWord(0))
.field('offsetToStart', DoubleWord(0))
.field('commentLength', Word(0));
const zipFile = Struct('ZipFile')
.field('localHeader', localHeader)
.field('data', data)
.field('centralDirectory', centralDirectory)
.field('endOfCentralDirectory', endOfCentralDirectory);
const offset = zipFile.getOffset('centralDirectory');
endOfCentralDirectory.get('offsetToStart').set(offset);
const fileBuffer = zipFile.toBuffer();
fs.writeFile('./test.zip', fileBuffer, () => {});
FAQs
`construct-js` is a library for creating byte level data structures.
We found that construct-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.