![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Wrap your buffers! Fluid API! Other things!
return Cursor.create(2)
.writeInt8(10)
.writeUInt32BE(10)
.buffer();
##Construction
//both work
var a = new Cursor(buffer);
var b = Cursor(buffer);
//also accepts Buffer constructor arguments
var c = Cursor(10); //size
var d = Cursor([0x01, 0x02]); // octals
###Cloning
//create a cursor pointing at the same buffer
//and the same index
var pos = curs.tell();
var cl = curs.clone();
pos == cl.tell(); //true
//create a cursor and immediately seek to a new pos
var pos = curs.rewind().tell();
var cl = curs.clone(100);
cl.tell() == pos; //false
##Reading
Cursor implements all of the Buffer.readXXX
methods in addition to toString
.
##Writing
Cursor implements all of the Buffer.writeXXX
methods in addition to write
and fill
.
However, Cursor deviates from Buffer by not offering a copy
method. Instead, use copyFrom
//bytes from c2 are copied into c1
c1.copyFrom(c2);
##Extending Sometimes it's beneficial to write have your own read/write primitives, while still providing access to the standard r/w operations. In those cases, extending Cursor can help.
var ProtocolCursor = Cursor.extend(
{
readInt: function()
{
return this.readInt32BE();
},
writeInt: function(n)
{
return this.writeInt32BE(n);
},
readCrazyObject: function()
{
var len = this.readInt();
var bytes = this.slice(len);
//unpack your bytes
...
}
});
var obj = ProtocolCursor(buffer).readCrazyObject();
Copyright (c) 2013 Dimerica Industries, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Cursor implementation for node buffers
The npm package cursor receives a total of 0 weekly downloads. As such, cursor popularity was classified as not popular.
We found that cursor 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.