How to use the @google-cloud/storage.File function in @google-cloud/storage

To help you get started, we’ve selected a few @google-cloud/storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github project-slippi / slippi-desktop-app / app / View on Github external
case "slippi:":
    const tmpDir = os.tmpdir();
    const destination = path.join(tmpDir, 'replay.slp');
    const replayPath = myUrl.searchParams.get('path');

    // The following path generation will not work on dev
    // __static didn't exist and __dirname didn't work. /shrug
    const appPath = app.getAppPath();
    const keyPath = path.join(appPath, "../app.asar.unpacked/static/storage-reader.json");`Keypath: ${keyPath}`);
    const storage = new Storage({
      projectId: 'slippi',
      keyFilename: keyPath,
    const bucket = storage.bucket('');
    const file = new File(bucket, replayPath);`Downloading file ${replayPath} to ${destination}`);

    // Dowload file
    await{ destination: destination });`Finished download`);

    // Wait until mainWindow exists so that we can send an IPC to play.
    // We are willing to wait for a few seconds before timing out
    await waitForMainWindow();
    mainWindow.webContents.send("play-replay", path.join(tmpDir, 'replay.slp'));

  case "file:":


Cloud Storage Client Library for Node.js

Latest version published 3 days ago

Package Health Score

91 / 100
Full package analysis