Gathering detailed insights and metrics for bytestreamjs
Gathering detailed insights and metrics for bytestreamjs
Gathering detailed insights and metrics for bytestreamjs
Gathering detailed insights and metrics for bytestreamjs
@penneo/bytestreamjs
ByteStream is a library making possibe to manipulates single bytes and bits on pure JavaScript
@fortanix/bytestreamjs
ByteStream is a library making possibe to manipulates single bytes and bits on pure JavaScript
bytestreamjs-wildcards
ByteStream is a library making possible to manipulates single bytes and bits on pure JavaScript
ByteStream.js is a set of classes manipulating bytes and bits with optimized for speed perfomance
npm install bytestreamjs
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
13 Stars
83 Commits
7 Forks
8 Watchers
3 Branches
5 Contributors
Updated on Oct 03, 2024
Latest Version
2.0.1
Package Id
bytestreamjs@2.0.1
Unpacked Size
166.00 kB
Size
17.81 kB
File Count
24
NPM Version
8.1.0
Node Version
16.13.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
ByteStream class is the major class for all others. It provides many useful function for making search for patterns and data transformation. Optimized for fast as possible data processing.
Method | Description |
---|---|
clear | Clear existing stream |
fromArrayBuffer | Initialize "Stream" object from existing "ArrayBuffer" |
fromUint8Array | Initialize "Stream" object from existing "Uint8Array" |
fromString | Initialize "Stream" object from existing string |
toString | Represent "Stream" object content as a string |
fromHexString | Initialize "Stream" object from existing hexdecimal string |
toHexString | Represent "Stream" object content as a hexdecimal string |
copy | Return copy of existing "Stream" |
slice | Return slice of existing "Stream" |
realloc | Change size of existing "Stream" |
append | Append a new "Stream" content to the current "Stream" |
insert | Insert "Stream" content to the current "Stream" at specific position |
isEqual | Check that two "Stream" objects has equal content |
isEqualView | Check that current "Stream" objects has equal content with input "Uint8Array" |
findPattern | Find any byte pattern in "Stream" |
findFirstIn | Find first position of any pattern from input array |
findAllIn | Find all positions of any pattern from input array |
findAllPatternIn | Find all positions of a pattern |
findFirstNotIn | Find first position of data, not included in patterns from input array |
findAllNotIn | Find all positions of data, not included in patterns from input array |
findFirstSequence | Find position of a sequence of any patterns from input array |
findAllSequences | Find all positions of a sequence of any patterns from input array |
findPairedPatterns | Find all paired patterns in the stream |
findPairedArrays | Find all paired patterns in the stream |
replacePattern | Replace one patter with other |
skipPatterns | Skip any pattern from input array |
skipNotPatterns | Skip any pattern not from input array |
SeqStream class is the aux class for sequential reading/writing data from/to ByteStream underline class.
Method | Description |
---|---|
resetPosition | Reset current position of the "SeqStream" |
findPattern | Find any byte pattern in "ByteStream" |
findFirstIn | Find first position of any pattern from input array |
findAllIn | Find all positions of any pattern from input array |
findFirstNotIn | Find first position of data, not included in patterns from input array |
findAllNotIn | Find all positions of data, not included in patterns from input array |
findFirstSequence | Find position of a sequence of any patterns from input array |
findAllSequences | Find position of a sequence of any patterns from input array |
findPairedPatterns | Find all paired patterns in the stream |
findPairedArrays | Find all paired patterns in the stream |
replacePattern | Replace one patter with other |
skipPatterns | Skip of any pattern from input array |
skipNotPatterns | Skip of any pattern from input array |
append | Append a new "Stream" content to the current "Stream" |
appendView | Append a "view" content to the current "Stream" |
appendChar | Append a new char to the current "Stream" |
getBlock | Get a block of data |
getUint32 | Get 4-byte unsigned integer value |
Main purpose of the BitStream is manipulating of each bit inside any ByteStream data.
Method | Description |
---|---|
clear | Clear existing stream |
fromByteStream | Initialize "BitStream" by data from existing "ByteStream" |
fromArrayBuffer | Initialize "BitStream" object from existing "ArrayBuffer" |
fromUint8Array | Initialize "BitStream" object from existing "Uint8Array" |
fromString | Initialize "BitStream" object from existing bit string |
toString | Represent "BitStream" object content as a string |
shiftRight | Shift entire "BitStream" value right to number of bits |
shiftLeft | Shift entire "BitStream" value left to number of bits |
slice | Return slice of existing "BitStream" |
copy | Return copy of existing "BitStream" |
shrink | Shrink unnecessary bytes in current stream accordingly to "bitsCount" value |
reverseBytes | Reverse bits order in each byte in the stream |
reverseValue | Reverse all bits in entire "BitStream" |
getNumberValue | Trying to represent entire "BitStream" as an unsigned integer |
findPattern | Find any bit pattern in "BitStream" |
findFirstIn | Find first position of any pattern from input array |
findAllIn | Find all positions of any pattern from input array |
findAllPatternIn | Find all positions of a pattern |
findFirstNotIn | Find first position of data, not included in patterns from input array |
findAllNotIn | Find all positions of data, not included in patterns from input array |
findFirstSequence | Find position of a sequence of any patterns from input array |
findAllSequences | Find position of a sequence of any patterns from input array |
findPairedPatterns | Find all paired patterns in the stream |
findPairedArrays | Find all paired patterns in the stream |
replacePattern | Replace one pattern with other |
skipPatterns | Skip any pattern from input array |
skipNotPatterns | Skip any pattern not from input array |
append | Append a new "BitStream" content to the current "BitStream" |
SeqBitStream class is the aux class for sequential reading/writing data from/to BitStream underline class.
Method | Description |
---|---|
getBits | Get next "length" bits from the stream |
getBitsString | Get string representation for the next "length" bits from the stream |
getBitsReversedValue | Get number value representation of the next "length" bits from the stream, preliminary reversed |
toString | Represent remaining bits in "BitStream" as a string |
The parseByteMap
function is intended to parse and check byte streams with determinated structure.
Example of map used as a kind of template. Exactly this map is using for parsing PDF xref table:
1let map = [ 2 { 3 type: "string", 4 name: "type", 5 minlength: 1, 6 maxlength: 1, 7 func: function(array){ 8 let result = { 9 status: (-1), 10 length: 1 11 }; 12 13 switch(array[0]) 14 { 15 case 0x6E: // "n" 16 result.value = "n"; 17 break; 18 case 0x66: // "f" 19 result.value = "f"; 20 break; 21 default: 22 return result; 23 } 24 25 result.status = 1; 26 27 return result; 28 } 29 }, 30 { 31 type: "check", 32 minlength: 1, 33 maxlength: 2, 34 func: function(array){ 35 let position = (-1); 36 37 if(array[0] == 0x0A) 38 position = 1; 39 if(array[1] == 0x0A) 40 position = 2; 41 42 return { 43 status: (position > 0) ? 1 : (-1), 44 length: position 45 }; 46 } 47 } 48];
Copyright (c) 2016-2022, Peculiar Ventures All rights reserved.
Author 2016-2018 Yury Strozhevsky.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/7 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More