How to use the @bentley/imodeljs-backend.IModelJsFs.writeFileSync function in @bentley/imodeljs-backend

To help you get started, we’ve selected a few @bentley/imodeljs-backend 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 imodeljs / imodeljs / test-apps / display-performance-test-app / src / backend / CsvWriter.ts View on Github external
export function createNewCsvFile(filePath: string, fileName: string, data: Map): boolean {
  const file = path.join(filePath, fileName);
  if (!IModelJsFs.existsSync(filePath)) createFilePath(filePath);
  if (!IModelJsFs.existsSync(file)) {
    try {
      let colNames = "";
      data.forEach((_value, colName) => {
        colNames += colName + ",";
      });
      colNames += "\r\n";
      IModelJsFs.writeFileSync(file, colNames);
    } catch (err) {
      /* Handle the error */
    }
    return true;
  } else {
    return false;
  }
}
github imodeljs / imodeljs / test-apps / display-performance-test-app / src / backend / WebMain.ts View on Github external
function setupStandaloneConfiguration() {
  const filename = process.env.SVT_STANDALONE_FILENAME;
  if (filename !== undefined) {
    const configuration: any = {};
    configuration.standalone = true;
    configuration.standalonePath = filename;
    configuration.viewName = process.env.SVT_STANDALONE_VIEWNAME; // optional
    configuration.iModelName = filename;
    IModelJsFs.writeFileSync(path.join(__dirname, "configuration.json"), JSON.stringify(configuration));
  }
}
github imodeljs / imodeljs / test-apps / display-performance-test-app / src / backend / backend.ts View on Github external
function setupStandaloneConfiguration() {
  const filename = process.env.SVT_STANDALONE_FILENAME;
  if (filename !== undefined) {
    const configuration: any = {};
    configuration.standalone = true;
    configuration.standalonePath = process.env.SVT_STANDALONE_FILEPATH; // optional (browser-use only)
    configuration.viewName = process.env.SVT_STANDALONE_VIEWNAME; // optional
    configuration.iModelName = filename;
    const configPathname = path.normalize(path.join(__dirname, "../webresources", "configuration.json"));
    IModelJsFs.writeFileSync(configPathname, JSON.stringify(configuration));
  }
}
github imodeljs / imodeljs / test-apps / display-performance-test-app / src / backend / CsvWriter.ts View on Github external
count++;
        if (opNames[opNamesIndex] === columns[columnsIndex + count])
          columnsIndex += count;
        else {
          origFile = addColumn(origFile, opNames[opNamesIndex], columnsIndex);
          columns.splice(columnsIndex, 0, opNames[opNamesIndex]);
          opNamesIndex++;
          columnsIndex++;
        }
      }
    } else {
      opNamesIndex++;
      columnsIndex++;
    }
  }
  IModelJsFs.writeFileSync(filePath, origFile);
}
github imodeljs / imodeljs / test-apps / display-performance-test-app / src / backend / DisplayPerfRpcImpl.ts View on Github external
public async savePng(fileName: string, png: string) {
    let filePath;
    if (MobileRpcConfiguration.isMobileBackend && process.env.DOCS) {
      filePath = process.env.DOCS;
      fileName = path.join(filePath, fileName);
    } else {
      filePath = this.getFilePath(fileName);
    }
    if (!IModelJsFs.existsSync(filePath)) createFilePath(filePath);
    if (IModelJsFs.existsSync(fileName)) IModelJsFs.unlinkSync(fileName);
    const buf = Buffer.from(png, "base64");
    IModelJsFs.writeFileSync(fileName, buf);
  }