Socket
Socket
Sign inDemoInstall

meros

Package Overview
Dependencies
2
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0-next.3 to 1.2.0-next.4

2

browser/index.js
const separator = '\r\n\r\n';
const decoder = new TextDecoder;
async function* generate(stream, boundary, options) {
boundary = '\r\n' + boundary;
const reader = stream.getReader(), is_eager = !options || !options.multiple;

@@ -28,2 +27,3 @@ let buffer = '', is_preamble = true, payloads = [];

is_preamble = false;
boundary = '\r\n' + boundary;
}

@@ -30,0 +30,0 @@ else {

@@ -1,1 +0,1 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).meros={})}(this,(function(e){const n="\r\n\r\n",t=new TextDecoder;e.meros=async function(e,i){if(!e.ok||!e.body||e.bodyUsed)return e;const o=e.headers.get("content-type");if(!o||!~o.indexOf("multipart/mixed"))return e;const s=o.indexOf("boundary=");return async function*(e,i,o){i="\r\n"+i;const s=e.getReader(),r=!o||!o.multiple;let d="",f=!0,l=[];try{let e;e:for(;!(e=await s.read()).done;){const o=t.decode(e.value),s=o.indexOf(i);let c=d.length;for(d+=o,~s?c+=s:c=d.indexOf(i),l=[];~c;){const e=d.substring(0,c),t=d.substring(c+i.length);if(f)f=!1;else{const i={},o=e.indexOf(n),s=d.slice(0,o).trim().split(/\r\n/);let f;for(;f=s.shift();)f=f.split(": "),i[f.shift().toLowerCase()]=f.join(": ");const c=e.lastIndexOf("\r\n",o+n.length);let a=e.substring(o+n.length,c>-1?void 0:c),u=!1;if(f=i["content-type"],f&&~f.indexOf("application/json"))try{a=JSON.parse(a),u=!0}catch(e){}if(f={headers:i,body:a,json:u},r?yield f:l.push(f),"--"===t.substring(0,2))break e}d=t,c=d.indexOf(i)}l.length&&(yield l)}}finally{l.length&&(yield l),s.releaseLock()}}(e.body,`--${~s?o.substring(s+9).trim().replace(/['"]/g,""):"-"}`,i)}}));
var global,factory;global=this,factory=function(e){const t="\r\n\r\n",n=new TextDecoder;e.meros=async function(e,o){if(!e.ok||!e.body||e.bodyUsed)return e;const i=e.headers.get("content-type");if(!i||!~i.indexOf("multipart/mixed"))return e;const r=i.indexOf("boundary=");return async function*(e,o,i){const r=e.getReader(),s=!i||!i.multiple;let l="",f=!0,d=[];try{let e;e:for(;!(e=await r.read()).done;){const i=n.decode(e.value),r=i.indexOf(o);let a=l.length;for(l+=i,~r?a+=r:a=l.indexOf(o),d=[];~a;){const e=l.substring(0,a),n=l.substring(a+o.length);if(f)f=!1,o="\r\n"+o;else{const o={},i=e.indexOf(t),r=l.slice(0,i).trim().split(/\r\n/);let f;for(;f=r.shift();)f=f.split(": "),o[f.shift().toLowerCase()]=f.join(": ");const a=e.lastIndexOf("\r\n",i+4);let c=e.substring(i+4,a>-1?void 0:a),y=!1;if(f=o["content-type"],f&&~f.indexOf("application/json"))try{c=JSON.parse(c),y=!0}catch(e){}if(f={headers:o,body:c,json:y},s?yield f:d.push(f),"--"===n.substring(0,2))break e}l=n,a=l.indexOf(o)}d.length&&(yield d)}}finally{d.length&&(yield d),r.releaseLock()}}(e.body,"--"+(~r?i.substring(r+9).trim().replace(/['"]/g,""):"-"),o)}},"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).meros={});
const separator = '\r\n\r\n';
async function* generate(stream, boundary, options) {
boundary = '\r\n' + boundary;
const len_boundary = Buffer.byteLength(boundary), is_eager = !options || !options.multiple;
let buffer = Buffer.alloc(0), is_preamble = true, payloads = [];
const is_eager = !options || !options.multiple;
let len_boundary = Buffer.byteLength(boundary), buffer = Buffer.alloc(0), is_preamble = true, payloads = [];
outer: for await (const chunk of stream) {

@@ -24,2 +23,4 @@ let idx_boundary = buffer.byteLength;

is_preamble = false;
boundary = '\r\n' + boundary;
len_boundary += 2;
}

@@ -26,0 +27,0 @@ else {

{
"name": "meros",
"version": "1.2.0-next.3",
"version": "1.2.0-next.4",
"description": "A fast 626B utility that makes reading multipart responses simple",

@@ -71,10 +71,7 @@ "keywords": [

"@rollup/plugin-node-resolve": "13.1.1",
"@types/node": "16.11.11",
"@types/node": "17.0.2",
"prettier": "2.5.1",
"rollup": "2.61.1",
"rollup-plugin-dts": "4.0.1",
"rollup-plugin-filesize": "9.1.1",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-typescript2": "0.31.1",
"tslib": "2.3.1",
"tsm": "2.2.1",

@@ -96,4 +93,4 @@ "typescript": "4.5.4",

"volta": {
"node": "16.11.0"
"node": "17.3.0"
}
}

@@ -48,7 +48,5 @@ <img src="logo.svg" alt="meros">

// Used with rxjs streams
from(parts).pipe(
tap((part) => {
// Do something with it
}),
);
from(parts).subscribe((part) => {
// Do something with it
});
```

@@ -55,0 +53,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc