{
	"version": 3,
	"sources": [
		"C:\\dev\\streamline-streams\\src\\readers._js"
	],
	"names": [
		"streams",
		"require",
		"exports",
		"Reader",
		"stream",
		"boundary",
		"options",
		"defaultSize",
		"emitter",
		"on",
		"ReadableStream",
		"setEncoding",
		"encoding",
		"readItem",
		"chunks",
		"len",
		"chunk",
		"length",
		"i",
		"indexOf",
		"unread",
		"substring",
		"push",
		"Error",
		"join",
		"close"
	],
	"mappings": ";;;;;;;AAMA,IAAIA,UAAUC,QAAQ,WAAR,CAAd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAC,QAAQC,MAAR,GAAiB,UAASC,MAAT,EAAiBC,QAAjB,EAA2BC,OAA3B;AAChBA,WAAUA,WAAW,EAArB;AACAA,SAAQC,WAAR,GAAsBD,QAAQC,WAAR,IAAuB,GAA7C;AACA,KAAI,CAACH,OAAOI,OAAR,IAAmB,OAAOJ,OAAOK,EAAd,KAAqB,UAA5C;AACC;AACAL,YAAS,IAAIJ,QAAQU,cAAZ,CAA2BN,MAA3B,EAAmCE,OAAnC,CAAT;AACAF,UAAOO,WAAP,CAAmBL,QAAQM,QAAR,IAAoB,MAAvC;AAHD;AAKA,KAAI,CAACP,QAAL,EAAeA,WAAW,IAAX;AACf,MAAKQ,QAAL;AAAA;AACC,OAAIC,SAAS,EAAb;AACA,OAAIC,MAAMT,QAAQC,WAAlB;AACA,UAAOH,MAAP;AACC,QAAIY,cAAQ,wEAAeD,MAAMV,SAASY,MAA9B,EAAZ;AACA,QAAID,SAAS,IAAb,EAAmBZ,SAAS,IAAT,CAAnB;AAEC,UAAIc,IAAIF,MAAMG,OAAN,CAAcd,QAAd,CAAR;AACA,UAAIa,KAAK,CAAT;AACCd,eAAOgB,MAAP,CAAcJ,MAAMK,SAAN,CAAgBH,IAAIb,SAASY,MAA7B,CAAd;AACAH,eAAOQ,IAAP,CAAYN,MAAMK,SAAN,CAAgB,CAAhB,EAAmBH,CAAnB,CAAZ;AACA;AAHD,cAIO,IAAIF,MAAMC,MAAN,KAAiBF,MAAMV,SAASY,MAApC;AACNb,eAAOgB,MAAP,CAAcJ,MAAMK,SAAN,CAAgBN,GAAhB,CAAd;AACAD,eAAOQ,IAAP,CAAYN,MAAMK,SAAN,CAAgB,CAAhB,EAAmBN,GAAnB,CAAZ;AAFM;AAIN;AACA,YAAI,qFAAmB,IAAvB,EACC,MAAM,IAAIQ,KAAJ,CAAU,sBAAsBlB,QAAtB,GAAiC,OAAjC,GAA2CW,KAArD,CAAN;AACDF,eAAOQ,IAAP,CAAYN,KAAZ;AACAZ,iBAAS,IAAT;AARM;AAPR;AAFD;AAqBA,UAAOU,OAAOG,MAAP,KAAkB,CAAlB,GAAsB,IAAtB,GAA6BH,OAAOU,IAAP,CAAY,EAAZ,CAApC;AAxBD;AAAA;AA0BA,MAAKC,KAAL;AAAA;AACCrB,YAAS,IAAT;AADD;AAAA;AAnCgB,CAAjB",
	"file": "readers._js",
	"sourcesContent": [
		"/**\r\n * Copyright (c) 2011 Bruno Jouhier <bruno.jouhier@sage.com>\r\n * MIT License\r\n */\r\n\"use strict\";\r\n\r\nvar streams = require(\"./streams\");\r\n\r\n/// !nodoc -- experimental\r\n/// \r\n/// # streamline-streams/lib/readers\r\n///  \r\n/// Readers module\r\n/// The `readers` module contains higher level readers built on top of pull-mode streams.\r\n/// \r\n/// This module is deprecated. Use x[ez-streams](https://github.com/Sage/ez-streams) instead.\r\n/// \r\nexports.Reader = function(stream, boundary, options) {\r\n\toptions = options || {};\r\n\toptions.defaultSize = options.defaultSize || 512;\r\n\tif (!stream.emitter && typeof stream.on === \"function\") {\r\n\t\t// break require string in 2 to fool client require\r\n\t\tstream = new streams.ReadableStream(stream, options);\r\n\t\tstream.setEncoding(options.encoding || \"utf8\");\r\n\t}\r\n\tif (!boundary) boundary = \"\\n\";\r\n\tthis.readItem = function(_) {\r\n\t\tvar chunks = [];\r\n\t\tvar len = options.defaultSize;\r\n\t\twhile (stream) {\r\n\t\t\tvar chunk = stream.read(_, len + boundary.length);\r\n\t\t\tif (chunk == null) stream = null;\r\n\t\t\telse {\r\n\t\t\t\tvar i = chunk.indexOf(boundary);\r\n\t\t\t\tif (i >= 0) {\r\n\t\t\t\t\tstream.unread(chunk.substring(i + boundary.length));\r\n\t\t\t\t\tchunks.push(chunk.substring(0, i));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t} else if (chunk.length === len + boundary.length) {\r\n\t\t\t\t\tstream.unread(chunk.substring(len));\r\n\t\t\t\t\tchunks.push(chunk.substring(0, len));\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// don't require boundary at end of stream\r\n\t\t\t\t\tif (stream.read(_) !== null)\r\n\t\t\t\t\t\tthrow new Error(\"missing boundary:\" + boundary + \" in: \" + chunk);\r\n\t\t\t\t\tchunks.push(chunk);\r\n\t\t\t\t\tstream = null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn chunks.length === 0 ? null : chunks.join('');\r\n\t};\r\n\tthis.close = function(_) {\r\n\t\tstream = null;\r\n\t};\r\n};\r\n"
	]
}