node_modules/@tensorflow/tfjs-data/dist/tf-data.js
/**
     * Provide a stream of chunks from a URL.
     *
     * Note this class first downloads the entire file into memory before providing
     * the first element from the stream.  This is because the Fetch API does not
     * yet reliably provide a reader stream for the response body.
     */
Provide a stream of chunks from a URL.

Note this class first downloads the entire file into memory before providing
the first element from the stream.  This is because the Fetch API does not
yet reliably provide a reader stream for the response body.
Provide a stream of chunks from a URL . Note this class first downloads the entire file into memory before providing the first element from the stream . This is because the Fetch API does not yet reliably provide a reader stream for the response body .
function urlChunkIterator(url, options) {
        if (options === void 0) { options = {}; }
        return __awaiter(this, void 0, void 0, function () {
            var response, blob, nodeFetch, unitArray;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        if (!tf.ENV.get('IS_BROWSER')) return [3 , 5];
                        return [4 , fetch(url)];
                    case 1:
                        response = _a.sent();
                        if (!response.ok) return [3 , 3];
                        return [4 , response.blob()];
                    case 2:
                        blob = _a.sent();
                        return [2 , new FileChunkIterator(blob, options)];
                    case 3: throw new Error(response.statusText);
                    case 4: return [3 , 9];
                    case 5:
                        nodeFetch = require('node-fetch');
                        if (typeof url !== 'string') {
                            throw new Error('URL must be a string. Request objects are not supported ' +
                                'in the node.js environment yet.');
                        }
                        return [4 , nodeFetch(url)];
                    case 6:
                        response = _a.sent();
                        if (!response.ok) return [3 , 8];
                        return [4 , response.buffer()];
                    case 7:
                        unitArray = _a.sent();
                        return [2 , new FileChunkIterator(unitArray, options)];
                    case 8: throw new Error(response.statusText);
                    case 9: return [2 ];
                }
            });
        });
    }
function urlChunkIterator ( url , options ) { if ( options === void 0 ) { options = { } ; } return __awaiter ( this , void 0 , void 0 , function ( ) { var response , blob , nodeFetch , unitArray ; return __generator ( this , function ( _a ) { switch ( _a . label ) { case 0 : if ( ! tf . ENV . get ( 'IS_BROWSER' ) ) return [ 3 , 5 ] ; return [ 4 , fetch ( url ) ] ; case 1 : response = _a . sent ( ) ; if ( ! response . ok ) return [ 3 , 3 ] ; return [ 4 , response . blob ( ) ] ; case 2 : blob = _a . sent ( ) ; return [ 2 , new FileChunkIterator ( blob , options ) ] ; case 3 : throw new Error ( response . statusText ) ; case 4 : return [ 3 , 9 ] ; case 5 : nodeFetch = require ( 'node-fetch' ) ; if ( typeof url !== 'string' ) { throw new Error ( 'URL must be a string. Request objects are not supported ' + 'in the node.js environment yet.' ) ; } return [ 4 , nodeFetch ( url ) ] ; case 6 : response = _a . sent ( ) ; if ( ! response . ok ) return [ 3 , 8 ] ; return [ 4 , response . buffer ( ) ] ; case 7 : unitArray = _a . sent ( ) ; return [ 2 , new FileChunkIterator ( unitArray , options ) ] ; case 8 : throw new Error ( response . statusText ) ; case 9 : return [ 2 ] ; } } ) ; } ) ; }
Provide a stream of chunks from a URL.
Provide a stream of chunks from a URL .
/*break*/ /*yield*/ /*break*/ /*yield*/ /*return*/ /*break*/ /*yield*/ /*break*/ /*yield*/ /*return*/ /*return*/