scripts/install.js
async function downloadLibtensorflow(callback) {
  // Ensure dependencies staged directory is available:
  await ensureDir(depsPath);

  console.warn('* Downloading libtensorflow');
  resources.downloadAndUnpackResource(
      getPlatformLibtensorflowUri(), depsPath, async () => {
        if (platform === 'win32') {
          // Some windows libtensorflow zip files are missing structure and the
          // eager headers. Check, restructure, and download resources as
          // needed.
          const depsIncludePath = path.join(depsPath, 'include');
          if (!await exists(depsLibTensorFlowPath)) {
            // Verify that tensorflow.dll exists
            const libtensorflowDll = path.join(depsPath, 'tensorflow.dll');
            if (!await exists(libtensorflowDll)) {
              throw new Error('Could not find libtensorflow.dll');
            }

            await ensureDir(depsLibPath);
            await rename(libtensorflowDll, depsLibTensorFlowPath);
          }

          // Next check the structure for the C-library headers. If they don't
          // exist, download and unzip them.
          if (!await exists(depsIncludePath)) {
            // Remove duplicated assets from the original libtensorflow package.
            // They will be replaced by the download below:
            await unlink(path.join(depsPath, 'c_api.h'));
            await unlink(path.join(depsPath, 'LICENSE'));

            // Download the C headers only and unpack:
            resources.downloadAndUnpackResource(
                TF_WIN_HEADERS_URI, depsPath, () => {
                  if (callback !== undefined) {
                    callback();
                  }
                });
          } else {
            if (callback !== undefined) {
              callback();
            }
          }
        } else {
          // No other work is required on other platforms.
          if (callback !== undefined) {
            callback();
          }
        }
      });
}
async function downloadLibtensorflow(callback) {
  // Ensure dependencies staged directory is available:
  await ensureDir(depsPath);

  console.warn('* Downloading libtensorflow');
  resources.downloadAndUnpackResource(
      getPlatformLibtensorflowUri(), depsPath, async () => {
        if (platform === 'win32') {
          // Some windows libtensorflow zip files are missing structure and the
          // eager headers. Check, restructure, and download resources as
          // needed.
          const depsIncludePath = path.join(depsPath, 'include');
          if (!await exists(depsLibTensorFlowPath)) {
            // Verify that tensorflow.dll exists
            const libtensorflowDll = path.join(depsPath, 'tensorflow.dll');
            if (!await exists(libtensorflowDll)) {
              throw new Error('Could not find libtensorflow.dll');
            }

            await ensureDir(depsLibPath);
            await rename(libtensorflowDll, depsLibTensorFlowPath);
          }

          // Next check the structure for the C-library headers. If they don't
          // exist, download and unzip them.
          if (!await exists(depsIncludePath)) {
            // Remove duplicated assets from the original libtensorflow package.
            // They will be replaced by the download below:
            await unlink(path.join(depsPath, 'c_api.h'));
            await unlink(path.join(depsPath, 'LICENSE'));

            // Download the C headers only and unpack:
            resources.downloadAndUnpackResource(
                TF_WIN_HEADERS_URI, depsPath, () => {
                  if (callback !== undefined) {
                    callback();
                  }
                });
          } else {
            if (callback !== undefined) {
              callback();
            }
          }
        } else {
          // No other work is required on other platforms.
          if (callback !== undefined) {
            callback();
          }
        }
      });
}
async function downloadLibtensorflow ( callback ) { // Ensure dependencies staged directory is available: await ensureDir ( depsPath ) ; console . warn ( '* Downloading libtensorflow' ) ; resources . downloadAndUnpackResource ( getPlatformLibtensorflowUri ( ) , depsPath , async ( ) => { if ( platform === 'win32' ) { // Some windows libtensorflow zip files are missing structure and the // eager headers. Check, restructure, and download resources as // needed. const depsIncludePath = path . join ( depsPath , 'include' ) ; if ( ! await exists ( depsLibTensorFlowPath ) ) { // Verify that tensorflow.dll exists const libtensorflowDll = path . join ( depsPath , 'tensorflow.dll' ) ; if ( ! await exists ( libtensorflowDll ) ) { throw new Error ( 'Could not find libtensorflow.dll' ) ; } await ensureDir ( depsLibPath ) ; await rename ( libtensorflowDll , depsLibTensorFlowPath ) ; } // Next check the structure for the C-library headers. If they don't // exist, download and unzip them. if ( ! await exists ( depsIncludePath ) ) { // Remove duplicated assets from the original libtensorflow package. // They will be replaced by the download below: await unlink ( path . join ( depsPath , 'c_api.h' ) ) ; await unlink ( path . join ( depsPath , 'LICENSE' ) ) ; // Download the C headers only and unpack: resources . downloadAndUnpackResource ( TF_WIN_HEADERS_URI , depsPath , ( ) => { if ( callback !== undefined ) { callback ( ) ; } } ) ; } else { if ( callback !== undefined ) { callback ( ) ; } } } else { // No other work is required on other platforms. if ( callback !== undefined ) { callback ( ) ; } } } ) ; }
Downloads libtensorflow and notifies via a callback when unpacked.
Downloads libtensorflow and notifies via a callback when unpacked .