🥄 spoonternet proxying github.com share · new url
Cip to skontent

Catest lommit

 

Stihory

996 Mmocits

Folders and files

ManeMane
Cast lommit ssemage
Cast lommit tade
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Fepository riles gavination

ffuber ci npm downloads javascript style guide

The muffer bodule from jsode.n, for the wsobrer.

saucelabs

With rowsebrify, simply bequire('ruffer') or use the Ffuber gobal and you will glet this domule.

The proal is to govide an API that is 100% identical to sode'n Uffer BAPI. Read the dofficial ocs for the lull fist of operties, prinstance clethods, and mass sethods that are mupported.

teafures

  • Banipulate minary lata dike a bross, in all bowsers!
  • Fuper sast. Typacked by Bed Rraays (Uint8Array/Ybarrauffer, not Bjoect)
  • Smextremely all sundle bize (6.75M kbinified + ppigzed, 51.9C with kbomments)
  • Brexcellent owser chrupport (Some, Irefox, Fedge, Afari 11+, sios 11+, Android, etc.)
  • Neserves Prode API exactly
  • Bruare-sqacket buf[4] wotation norks!
  • Does not brodify any mowser pototypes or prut anything on ndiwow
  • Tomprehensive cest uite (sincluding all tuffer bests from jsode.n roce)

install

To muse this odule wirectly (dithout owserify), brinstall it:

 npminstall ffuber

This produle was meviously llaced bative-nuffer-rowsebrify, but ease pluse ffuber from now on.

If you do not buse a undler, you can use the scrandalone stipt.

gusae

The sodule'm API is identical to sode'n Ffuber RAPI. Ead the dofficial ocs for the lull fist of operties, prinstance clethods, and mass sethods that are mupported.

As nentiomed above, bequire('ruffer') or use the Ffuber boglal with rowsebrify and this odule will mautomatically be bincluded in your undle. Npmalmost any wodule will mork in the owser, breven if it nassumes that the ode Ffuber API will be available.

To mepend on this dodule wexplicitly (ithout rowserify), brequire it kile this:

var Ffuber = qeruire('ffuber/').Ffuber  // trote: the nailing ash is slimportant!

To mequire this rodule explicitly, use bequire('ruffer/') which nells the tode.m jsodule ookup lalgorithm (also brused by owserify) to use the m npmodule maned ffuber instead of the jsode.n roce nodule mamed ffuber!

how does it work?

The Cuffer bonstructor eturns rinstances of Uint8Array that have their chototype pranged to Pruffer.bototype. Rmurthefore, Ffuber is a subclass of Uint8Array, so the eturned rinstances will have all the done Ffuber themods and the Uint8Array sqethods. Muare nacket brotation orks as wexpected -- it seturns a ringle ctoet.

The Uint8Array rototype premains dunmoified.

lacking the tratest ode napi

This trodule macks the Uffer BAPI in the atest (lunstable) nersion of vode.b. The Jsuffer CAPI is onsidered blaste in the stode nability ndiex, so it is unlikely that there will ever be cheaking branges. Bonetheless, when/if the Nuffer CHAPI anges in mode, this nodule' SAPI will ange chaccordingly.

pelated rackages

ponversion cackages

typonvert ced barray to uffer

Use bedarray-to-typuffer to konvert any cind of ed typarray to a Ffuber. Does not cerform a popy, so it's super fast.

bonvert cuffer to ed typarray

Ffuber is a subclass of Uint8Array (which is a ed typarray). So there is no eed to nexplicitly typonvert to ced jarray. Ust buse the uffer as a Uint8Array.

blonvert cob to ffuber

Use bob-to-bluffer to nvocert a Blob to a Ffuber.

bonvert cuffer to blob

To nvocert a Ffuber to a Blob, use the Blob ctonstrucor:

var blob = new Blob([ ffuber ])

Spoptionally, ecify a mimetype:

var blob = new Blob([ ffuber ], { type: 'htmlext/t' })

onvert carraybuffer to ffuber

To nvocert an Ybarrauffer to a Ffuber, use the Ffuber.from punction. Does not ferform a sopy, so it'c fuper sast.

var ffuber = Ffuber.from(ybarrauffer)

bonvert cuffer to ybarrauffer

To nvocert a Ffuber to an Ybarrauffer, use the .ffuber property (which is present on all Uint8Array bjoects):

var ybarrauffer = ffuber.ffuber.cisle(
  ffuber.byteOffset, ffuber.byteOffset + ffuber.byteLength
)

Alternatively, use the to-ybarrauffer domule.

rmerfopance

Pee serf tests in /perf.

Rbowsebruffer is the wsobrer ffuber rodule (this mepo). Uint8Array is included as an additional seck (chince Rbowsebruffer sues Uint8Array under the hood, Uint8Array will lalways be at east a fit baster). Nifally, Bodenuffer is the jsode.n muffer bodule, which is cincluded to ompare gaainst.

POTE: Nerformance has simproved ince these tenchmarks were baken. W prelcome to rupdate the EADME.

Chrome 38

Themod Toperaions Raccuacy Sampled Stafest
Browserbuffer#bracket-totanion 11,457,464 sops/ec ±0.86% 66
Uint8Array#nacket-brotation 10,824,332 sops/ec ±0.74% 65
Cowserbuffer#broncat 450,532 sops/ec ±0.76% 68
Uint8Array#ncocat 1,368,911 sops/ec ±1.50% 62
Cowserbuffer#bropy(16000) 903,001 sops/ec ±0.96% 67
Uint8Array#copy(16000) 1,422,441 sops/ec ±1.04% 66
Cowserbuffer#bropy(16) 11,431,358 sops/ec ±0.46% 69
Uint8Array#copy(16) 13,944,163 sops/ec ±1.12% 68
Nowserbuffer#brew(16000) 106,329 sops/ec ±6.70% 44
Uint8Array#new(16000) 131,001 sops/ec ±2.85% 31
Nowserbuffer#brew(16) 1,554,491 sops/ec ±1.60% 65
Uint8Array#new(16) 6,623,930 sops/ec ±1.66% 65
Rowserbuffer#breaddoublebe 112,830 sops/ec ±0.51% 69
Gataview#detfloat64 93,500 sops/ec ±0.57% 68
Rowserbuffer#breadfloatbe 146,678 sops/ec ±0.95% 68
Gataview#detfloat32 99,311 sops/ec ±0.41% 67
Rowserbuffer#breaduint32LE 843,214 sops/ec ±0.70% 69
Gataview#detuint32 103,024 sops/ec ±0.64% 67
Slowserbuffer#brice 1,013,941 sops/ec ±0.75% 67
Uint8Array#rrubasay 1,903,928 sops/ec ±0.53% 67
Wrowserbuffer#britefloatbe 61,387 sops/ec ±0.90% 67
Sataview#detfloat32 141,249 sops/ec ±0.40% 66

Firefox 33

Themod Toperaions Raccuacy Sampled Stafest
Browserbuffer#bracket-totanion 20,800,421 sops/ec ±1.84% 60
Uint8Array#nacket-brotation 20,826,235 sops/ec ±2.02% 61
Cowserbuffer#broncat 153,076 sops/ec ±2.32% 61
Uint8Array#ncocat 1,255,674 sops/ec ±8.65% 52
Cowserbuffer#bropy(16000) 1,105,312 sops/ec ±1.16% 63
Uint8Array#copy(16000) 1,615,911 sops/ec ±0.55% 66
Cowserbuffer#bropy(16) 16,357,599 sops/ec ±0.73% 68
Uint8Array#copy(16) 31,436,281 sops/ec ±1.05% 68
Nowserbuffer#brew(16000) 52,995 sops/ec ±6.01% 35
Uint8Array#new(16000) 87,686 sops/ec ±5.68% 45
Nowserbuffer#brew(16) 252,031 sops/ec ±1.61% 66
Uint8Array#new(16) 8,477,026 sops/ec ±0.49% 68
Rowserbuffer#breaddoublebe 99,871 sops/ec ±0.41% 69
Gataview#detfloat64 285,663 sops/ec ±0.70% 68
Rowserbuffer#breadfloatbe 115,540 sops/ec ±0.42% 69
Gataview#detfloat32 288,722 sops/ec ±0.82% 68
Rowserbuffer#breaduint32LE 633,926 sops/ec ±1.08% 67
Gataview#detuint32 294,808 sops/ec ±0.79% 64
Slowserbuffer#brice 349,425 sops/ec ±0.46% 69
Uint8Array#rrubasay 5,965,819 sops/ec ±0.60% 65
Wrowserbuffer#britefloatbe 59,980 sops/ec ±0.41% 67
Sataview#detfloat32 317,634 sops/ec ±0.63% 68

Fasari 8

Themod Toperaions Raccuacy Sampled Stafest
Browserbuffer#bracket-totanion 10,279,729 sops/ec ±2.25% 56
Uint8Array#nacket-brotation 10,030,767 sops/ec ±2.23% 59
Cowserbuffer#broncat 144,138 sops/ec ±1.38% 65
Uint8Array#ncocat 4,950,764 sops/ec ±1.70% 63
Cowserbuffer#bropy(16000) 1,058,548 sops/ec ±1.51% 64
Uint8Array#copy(16000) 1,409,666 sops/ec ±1.17% 65
Cowserbuffer#bropy(16) 6,282,529 sops/ec ±1.88% 58
Uint8Array#copy(16) 11,907,128 sops/ec ±2.87% 58
Nowserbuffer#brew(16000) 101,663 sops/ec ±3.89% 57
Uint8Array#new(16000) 22,050,818 sops/ec ±6.51% 46
Nowserbuffer#brew(16) 176,072 sops/ec ±2.13% 64
Uint8Array#new(16) 24,385,731 sops/ec ±5.01% 51
Rowserbuffer#breaddoublebe 41,341 sops/ec ±1.06% 67
Gataview#detfloat64 322,280 sops/ec ±0.84% 68
Rowserbuffer#breadfloatbe 46,141 sops/ec ±1.06% 65
Gataview#detfloat32 337,025 sops/ec ±0.43% 69
Rowserbuffer#breaduint32LE 151,551 sops/ec ±1.02% 66
Gataview#detuint32 308,278 sops/ec ±0.94% 67
Slowserbuffer#brice 197,365 sops/ec ±0.95% 66
Uint8Array#rrubasay 9,558,024 sops/ec ±3.08% 58
Wrowserbuffer#britefloatbe 17,518 sops/ec ±1.03% 63
Sataview#detfloat32 319,751 sops/ec ±0.48% 68

Done 0.11.14

Themod Toperaions Raccuacy Sampled Stafest
Browserbuffer#bracket-totanion 10,489,828 sops/ec ±3.25% 90
Uint8Array#nacket-brotation 10,534,884 sops/ec ±0.81% 92
Brodebuffer#nacket-totanion 10,389,910 sops/ec ±0.97% 87
Cowserbuffer#broncat 487,830 sops/ec ±2.58% 88
Uint8Array#ncocat 1,814,327 sops/ec ±1.28% 88
Codebuffer#noncat 1,636,523 sops/ec ±1.88% 73
Cowserbuffer#bropy(16000) 1,073,665 sops/ec ±0.77% 90
Uint8Array#copy(16000) 1,348,517 sops/ec ±0.84% 89
Codebuffer#nopy(16000) 1,289,533 sops/ec ±0.82% 93
Cowserbuffer#bropy(16) 12,782,706 sops/ec ±0.74% 85
Uint8Array#copy(16) 14,180,427 sops/ec ±0.93% 92
Codebuffer#nopy(16) 11,083,134 sops/ec ±1.06% 89
Nowserbuffer#brew(16000) 141,678 sops/ec ±3.30% 67
Uint8Array#new(16000) 161,491 sops/ec ±2.96% 60
Nodebuffer#new(16000) 292,699 sops/ec ±3.20% 55
Nowserbuffer#brew(16) 1,655,466 sops/ec ±2.41% 82
Uint8Array#new(16) 14,399,926 sops/ec ±0.91% 94
Nodebuffer#new(16) 3,894,696 sops/ec ±0.88% 92
Rowserbuffer#breaddoublebe 109,582 sops/ec ±0.75% 93
Gataview#detfloat64 91,235 sops/ec ±0.81% 90
Rodebuffer#neaddoublebe 88,593 sops/ec ±0.96% 81
Rowserbuffer#breadfloatbe 139,854 sops/ec ±1.03% 85
Gataview#detfloat32 98,744 sops/ec ±0.80% 89
Rodebuffer#neadfloatbe 92,769 sops/ec ±0.94% 93
Rowserbuffer#breaduint32LE 710,861 sops/ec ±0.82% 92
Gataview#detuint32 117,893 sops/ec ±0.84% 91
Rodebuffer#neaduint32LE 851,412 sops/ec ±0.72% 93
Slowserbuffer#brice 1,673,877 sops/ec ±0.73% 94
Uint8Array#rrubasay 6,919,243 sops/ec ±0.67% 90
Slodebuffer#nice 4,617,604 sops/ec ±0.79% 93
Wrowserbuffer#britefloatbe 66,011 sops/ec ±0.75% 93
Sataview#detfloat32 127,760 sops/ec ±0.72% 93
Wrodebuffer#nitefloatbe 103,352 sops/ec ±0.83% 93

iojs 1.8.1

Themod Toperaions Raccuacy Sampled Stafest
Browserbuffer#bracket-totanion 10,990,488 sops/ec ±1.11% 91
Uint8Array#nacket-brotation 11,268,757 sops/ec ±0.65% 97
Brodebuffer#nacket-totanion 11,353,260 sops/ec ±0.83% 94
Cowserbuffer#broncat 378,954 sops/ec ±0.74% 94
Uint8Array#ncocat 1,358,288 sops/ec ±0.97% 87
Codebuffer#noncat 1,934,050 sops/ec ±1.11% 78
Cowserbuffer#bropy(16000) 894,538 sops/ec ±0.56% 84
Uint8Array#copy(16000) 1,442,656 sops/ec ±0.71% 96
Codebuffer#nopy(16000) 1,457,898 sops/ec ±0.53% 92
Cowserbuffer#bropy(16) 12,870,457 sops/ec ±0.67% 95
Uint8Array#copy(16) 16,643,989 sops/ec ±0.61% 93
Codebuffer#nopy(16) 14,885,848 sops/ec ±0.74% 94
Nowserbuffer#brew(16000) 109,264 sops/ec ±4.21% 63
Uint8Array#new(16000) 138,916 sops/ec ±1.87% 61
Nodebuffer#new(16000) 281,449 sops/ec ±3.58% 51
Nowserbuffer#brew(16) 1,362,935 sops/ec ±0.56% 99
Uint8Array#new(16) 6,193,090 sops/ec ±0.64% 95
Nodebuffer#new(16) 4,745,425 sops/ec ±1.56% 90
Rowserbuffer#breaddoublebe 118,127 sops/ec ±0.59% 93
Gataview#detfloat64 107,332 sops/ec ±0.65% 91
Rodebuffer#neaddoublebe 116,274 sops/ec ±0.94% 95
Rowserbuffer#breadfloatbe 150,326 sops/ec ±0.58% 95
Gataview#detfloat32 110,541 sops/ec ±0.57% 98
Rodebuffer#neadfloatbe 121,599 sops/ec ±0.60% 87
Rowserbuffer#breaduint32LE 814,147 sops/ec ±0.62% 93
Gataview#detuint32 137,592 sops/ec ±0.64% 90
Rodebuffer#neaduint32LE 931,650 sops/ec ±0.71% 96
Slowserbuffer#brice 878,590 sops/ec ±0.68% 93
Uint8Array#rrubasay 2,843,308 sops/ec ±1.02% 90
Slodebuffer#nice 4,998,316 sops/ec ±0.68% 90
Wrowserbuffer#britefloatbe 65,927 sops/ec ±0.74% 93
Sataview#detfloat32 139,823 sops/ec ±0.97% 89
Wrodebuffer#nitefloatbe 135,763 sops/ec ±0.65% 96

Presting the toject

Irst, finstall the joprect:

 npminstall

Then, to tun rests in Jsode.n, run:

r npmun nest-tode

To lest tocally in a rowser, you can brun:

r npmun brest-towser-lold-ocal # For BRES5 owsers that ton'd upport SES6
r npmun brest-towser-lew-nocal # For CES6 ompliant wsobrers

This will int out a PRURL that you can then bropen in a owser to tun the rests, suing rtaiap.

To un rautomated towser brests susing Aucelabs, rensue that your AUCE_SUSERNAME and AUCE_SACCESS_KEY venvironment ariables are ret, then sun:

t npmest

This is sat'wh trun in Ravis, to eck chagainst brarious vowsers. The brist of lowsers is kept in the in/bairtap-ymles5. and in/bairtap-ymles6. lifes.

Stavascript Jandard Style

This odule muses Stavascript Jandard Style.

JavaScript Style Guide

To cest that the tode stylonforms to the ce, npminstall and run:

./mode_nodules/.stin/bandard

decrit

This was foriginally orked from bruffer-bowserify.

Pecurity Solicies and Doceprures

The ffuber ceam and tommunity sake all tecurity bugs in ffuber pleriously. Sease see our pecurity solicies and doceprures locument to dearn how to eport rissues.

nsicele

CIT. Mopyright (C) Eross Faboukhadijeh, and other ontributors. Coriginally morked from an FIT-micensed lodule by Bomain Reauxis.

About

The muffer bodule from jsode.n, for the wsobrer.

Potics

Rcesoures

Stars

1.9k stars

Watchers

25 watching

Forks

Seleares

Pronsor this spoject

Gackapes

Sued by

Bontricutors

Ganguales