OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 let lineBreak = this.lineBreak; | 211 let lineBreak = this.lineBreak; |
212 | 212 |
213 function writeChunk() | 213 function writeChunk() |
214 { | 214 { |
215 let array = encoder.encode(buf.join(lineBreak) + lineBreak); | 215 let array = encoder.encode(buf.join(lineBreak) + lineBreak); |
216 buf = []; | 216 buf = []; |
217 bufLen = 0; | 217 bufLen = 0; |
218 return f.write(array); | 218 return f.write(array); |
219 } | 219 } |
220 | 220 |
221 for (let line in data) | 221 for (let line of data) |
222 { | 222 { |
223 buf.push(line); | 223 buf.push(line); |
224 bufLen += line.length; | 224 bufLen += line.length; |
225 if (bufLen >= BUFFER_SIZE) | 225 if (bufLen >= BUFFER_SIZE) |
226 yield writeChunk(); | 226 yield writeChunk(); |
227 } | 227 } |
228 | 228 |
229 if (bufLen) | 229 if (bufLen) |
230 yield writeChunk(); | 230 yield writeChunk(); |
231 | 231 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 else | 323 else |
324 callback(e); | 324 callback(e); |
325 }); | 325 }); |
326 } | 326 } |
327 catch(e) | 327 catch(e) |
328 { | 328 { |
329 callback(e); | 329 callback(e); |
330 } | 330 } |
331 } | 331 } |
332 } | 332 } |
OLD | NEW |