packages/fastman/bin/fastman-import.js
async function importing(file) {
  await helpers.checkApiKey();

  if (typeof file === "undefined") {
    stderr("collection file not given!");
    process.exit(1);
  }

  const collection = jsonfile.readFileSync(file);
  const collections = await apis.listCollections();
  const { info = {} } = collection;
  const found = collections.find(c => c.name === info.name);

  if (found) {
    await apis.updateCollection(found.id, collection);
    stdout("updated collection", info.name);
  } else {
    await apis.createCollection(collection);
    stdout("created collection", info.name);
  }
}
async function importing(file) {
  await helpers.checkApiKey();

  if (typeof file === "undefined") {
    stderr("collection file not given!");
    process.exit(1);
  }

  const collection = jsonfile.readFileSync(file);
  const collections = await apis.listCollections();
  const { info = {} } = collection;
  const found = collections.find(c => c.name === info.name);

  if (found) {
    await apis.updateCollection(found.id, collection);
    stdout("updated collection", info.name);
  } else {
    await apis.createCollection(collection);
    stdout("created collection", info.name);
  }
}
async function importing ( file ) { await helpers . checkApiKey ( ) ; if ( typeof file === "undefined" ) { stderr ( "collection file not given!" ) ; process . exit ( 1 ) ; } const collection = jsonfile . readFileSync ( file ) ; const collections = await apis . listCollections ( ) ; const { info = { } } = collection ; const found = collections . find ( c => c . name === info . name ) ; if ( found ) { await apis . updateCollection ( found . id , collection ) ; stdout ( "updated collection" , info . name ) ; } else { await apis . createCollection ( collection ) ; stdout ( "created collection" , info . name ) ; } }
import collection file
@param {string} file collection file path
import collection file