
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
char-buffer
Advanced tools
Collect CharCodes and convert them to a string.
Install node.js (npm comes with node).
Install CharBuffer from NPM:
npm install char-buffer
Install node.js (npm comes with node).
Install component:
npm install component --global
Create component.json
:
{
"name": "getting-started",
"dependencies": {
"schnittstabil/char-buffer": "*"
}
}
Install dependencies:
component install
Run build
component build
Install node.js (npm comes with node).
Install Bower:
npm install bower --global
Install CharBuffer from bower.io:
bower install char-buffer
CharBuffer
provides multiple implementations to collect CharCodes
via a common interface (CharBuffer.CharBuffer
):
CharBuffer.StringBuffer
uses a single String
CharBuffer.StringArrayBuffer
uses an Array
of String
sCharBuffer.TypedArrayBuffer
uses an Uint16ArrayCharBuffer.NodeBuffer
uses a Node.js Buffervar buffer;
// Create the default CharBuffer of your platform:
buffer = new CharBuffer();
// Same as before, but provide an estimate of the length of your string:
buffer = new CharBuffer(3);
// Create a specific CharBuffer implementation, if supported:
if(CharBuffer.TypedArrayBuffer.isSupported)
buffer = new CharBuffer.TypedArrayBuffer(3);
}
// Append a CharCode:
buffer.append(102);
// Append two more CharCodes:
buffer.append(111).append(111);
// Output 'foo':
console.log(buffer.toString());
// Create the default CharBuffer implementation:
var CharBuffer = require('char-buffer'),
buffer = new CharBuffer(3);
// Or create a specific CharBuffer implementation by CharBuffer:
var CharBuffer = require('char-buffer'),
TypedArrayBuffer = CharBuffer.TypedArrayBuffer,
buffer = new TypedArrayBuffer(3);
// Or create a specific CharBuffer implementation by package:
var TypedArrayBuffer = require('char-buffer/typed-array-buffer'),
buffer = new TypedArrayBuffer(3);
// Output 'foo':
console.log(buffer.append(102).append(111).append(111).toString());
<script src="build/build.js"></script>
<script>
// Create the default CharBuffer implementation:
var CharBuffer = require('char-buffer'),
buffer = new CharBuffer(3);
// Or create a specific CharBuffer implementation:
var CharBuffer = require('char-buffer'),
TypedArrayBuffer = CharBuffer.TypedArrayBuffer,
buffer = new TypedArrayBuffer(3);
// Output 'foo'
console.log(buffer.append(102).append(111).append(111).toString());
</script>
<script src="bower_components/char-buffer/char-buffer.global.js"></script>
<script>
// Create the default CharBuffer implementation:
var buffer = new CharBuffer(3);
// Or create a specific CharBuffer implementation:
var TypedArrayBuffer = CharBuffer.TypedArrayBuffer,
buffer = new TypedArrayBuffer(3);
// Output 'foo'
console.log(buffer.append(102).append(111).append(111).toString());
</script>
See Asynchronous Module Definition (AMD) for details.
<script src="path/to/your/amd/loader.js"></script>
<script src="bower_components/char-buffer/char-buffer.amd.js"></script>
<script>
/**
* Use the CharBuffer package:
*/
require(['char-buffer'], function(CharBuffer){
// create the default CharBuffer implementation:
var buffer = new CharBuffer(3);
// Or create a specific CharBuffer implementation by CharBuffer:
var TypedArrayBuffer = CharBuffer.TypedArrayBuffer,
buffer = new TypedArrayBuffer(3);
// Output 'foo'
console.log(buffer.append(102).append(111).append(111).toString());
});
/**
* Or use a specific CharBuffer package:
*/
require(['char-buffer/typed-array-buffer'], function(TypedArrayBuffer){
var buffer = new TypedArrayBuffer(3);
// Output 'foo'
console.log(buffer.append(102).append(111).append(111).toString());
});
</script>
Copyright (c) 2014 Michael Mayer
Licensed under the MIT license.
FAQs
Collect CharCodes and convert them to string.
We found that char-buffer 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.