{
	"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",
		"length",
		"chunk",
		"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;AAAA;AAAA;AAAA;AAAA;AACKC,YADL,GACc,EADd;AAEKC,SAFL,GAEWT,QAAQC,WAFnB;;AAAA;AAAA,WAGQH,MAHR;AAAA;AAAA;AAAA;;AAAA;AAAA,aAIc,wEAAeW,MAAMV,SAASW,MAA9B,EAJd;;AAAA;AAIMC,WAJN;;AAAA,YAKMA,SAAS,IALf;AAAA;AAAA;AAAA;;AAKqBb,eAAS,IAAT;AALrB;AAAA;;AAAA;AAOOc,OAPP,GAOWD,MAAME,OAAN,CAAcd,QAAd,CAPX;;AAAA,YAQOa,KAAK,CARZ;AAAA;AAAA;AAAA;;AASId,aAAOgB,MAAP,CAAcH,MAAMI,SAAN,CAAgBH,IAAIb,SAASW,MAA7B,CAAd;AACAF,aAAOQ,IAAP,CAAYL,MAAMI,SAAN,CAAgB,CAAhB,EAAmBH,CAAnB,CAAZ;AAVJ;;AAAA;AAAA,YAYcD,MAAMD,MAAN,KAAiBD,MAAMV,SAASW,MAZ9C;AAAA;AAAA;AAAA;;AAaIZ,aAAOgB,MAAP,CAAcH,MAAMI,SAAN,CAAgBN,GAAhB,CAAd;AACAD,aAAOQ,IAAP,CAAYL,MAAMI,SAAN,CAAgB,CAAhB,EAAmBN,GAAnB,CAAZ;AAdJ;AAAA;;AAAA;AAAA;AAAA,aAiBQ,wEAjBR;;AAAA;AAAA;;AAAA,4BAiB2B,IAjB3B;AAAA;AAAA;AAAA;;AAAA,YAkBW,IAAIQ,KAAJ,CAAU,sBAAsBlB,QAAtB,GAAiC,OAAjC,GAA2CY,KAArD,CAlBX;;AAAA;AAmBIH,aAAOQ,IAAP,CAAYL,KAAZ;AACAb,eAAS,IAAT;;AApBJ;AAAA;AAAA;;AAAA;AAAA,uCAwBQU,OAAOE,MAAP,KAAkB,CAAlB,GAAsB,IAAtB,GAA6BF,OAAOU,IAAP,CAAY,EAAZ,CAxBrC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BA,MAAKC,KAAL;AAAA;AAAA;AAAA;AAAA;AACCrB,eAAS,IAAT;;AADD;AAAA;AAAA;AAAA;AAAA;AAAA;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"
	]
}