![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
This is a small library to encode and decode bencoded (bittorrent) stuff. Bencoding is specified here.
github repository is here
Installable via npm (npm package name is bncode, note spelling!):
npm install bncode
Encoding works as follows:
var benc = require("bncode"),
exmp = {}
exmp.bla = "blup"
exmp.foo = "bar"
exmp.one = 1
exmp.woah = {}
exmp.woah.arr = []
exmp.woah.arr.push(1)
exmp.woah.arr.push(2)
exmp.woah.arr.push(3)
exmp.str = new Buffer("Buffers work too")
var bencBuffer = benc.encode(exmp)
// d3:bla4:blup3:foo3:bar3:onei1e4:woahd3:arr \
// li1ei2ei3eee3:str16:Buffers work tooe
Decoding will work progressively, e.g. if you're receiving partial bencoded strings on the network:
var benc = require("bncode"),
buf = null
decoder = new benc.decoder()
while (buf = receiveData()) {
decoder.decode(buf)
}
log(decoder.result())
Or "all in one"
var benc = require("bncode"),
buf = getBuffer(),
dec = benc.decode(buf)
log(dec.bla)
There are some subtleties concerning bencoded strings. These are decoded as Buffer objects because they are just strings of raw bytes and as such would wreak havoc with multi byte strings in javascript.
The exception to this is strings appearing as keys in bencoded dicts. These are decoded as Javascript Strings, as they should always be strings of (ascii) characters and if they weren't decoded as JS Strings, dict's couldn't be mapped to Javascript objects.
+----------------------------------------------------+
| | |
| Bencoded | Javascript |
|====================================================|
| Strings | node Buffers, unless they are |
| | Dictionary keys, in which case |
| | they become Javascript Strings |
|----------------+-----------------------------------|
| Integers | Number |
|----------------+-----------------------------------|
| Lists | Array |
|----------------+-----------------------------------|
| Dictionaries | Object |
| | |
+----------------------------------------------------+
The code makes a best effort to encode Javascript to bencoding. If you stick to basic types (Arrays, Objects with String keys and basic values, Strings, Buffers and Numbers) you shouldn't encounter suprises. Expect surprises (mainly not being able to round-trip encode/decode) if you encode fancy data-types.
bncode was written by Tim Becker (tim.becker@kuriositaet.de) I can be reached via email or (preferably) submit a bug to the github repository.
MIT, see LICENSE
FAQs
bittorrent bencoding and decoding.
We found that bncode 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
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.