Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
char-buffer
Advanced tools
Collect CharCodes and convert them to a string.
CharBuffer
provides multiple implementations to collect CharCodes
via a common interface (CharBuffer.AbstractCharBuffer
):
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());
See Ubuntu Launchpad for details.
$ sudo add-apt-repository ppa:schnittstabil/node-char-buffer
$ sudo apt-get install node-char-buffer
Install node.js (npm comes with node).
Install CharBuffer from NPM:
npm install char-buffer
// 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());
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
<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>
Install node.js (npm comes with node).
Install Bower:
npm install bower --global
Install CharBuffer from bower.io:
bower install char-buffer
See systemjs/systemjs for details.
Install system.js:
bower install system.js
<script type="text/javascript" src="bower_components/traceur/traceur.js"></script>
<script type="text/javascript" src="bower_components/es6-module-loader/dist/es6-module-loader.js"></script>
<script type="text/javascript" src="bower_components/system.js/dist/system.js"></script>
<script type="module">
import CharBuffer from 'bower_components/char-buffer/char-buffer';
import TypedArrayBuffer from 'bower_components/char-buffer/typed-array-buffer';
// Create the default CharBuffer implementation:
var buffer = new CharBuffer(3);
// Or create a specific CharBuffer implementation:
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>
v0.7.0
v0.6.2
v0.6.1
v0.6.0 char-buffer becomes more array-like
v0.5.0 component support
v0.4.0 char-buffer becomes more string-like
Copyright (c) 2014 Michael Mayer
Licensed under the MIT license.
FAQs
Collect CharCodes and convert them to string.
The npm package char-buffer receives a total of 1,742 weekly downloads. As such, char-buffer popularity was classified as popular.
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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.