How to use the ini.encode function in ini

To help you get started, we’ve selected a few ini 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 Tarnadas / smmdb / website / src / server / scripts / api.ts View on Github external
public static async getCourses (app: any, req: any, res: any, apiData: any): Promise {
    const auth = req.get('Authorization')
    const apiKey = auth != null && auth.includes('APIKEY ') && auth.split('APIKEY ')[1]
    const account = await Account.getAccountByAPIKey(apiKey)
    if (apiData.prettify) {
      app.set('json spaces', 2)
    }
    const courses = await this.filterCourses(account ? account._id : null, apiData)
    if (apiData.format === 'ini') {
      res.set('Content-type', 'text/plain')
      res.send(`${encode({ General: { lvlcount: courses.length } })}\n${encode(JSON.parse(JSON.stringify(courses)), {
        section: 'Level',
        whitespace: false // TODO
      })}`)
    } else {
      res.json(courses)
    }
    if (apiData.prettify) {
      app.set('json spaces', 0)
    }
  }
github bitrix-tools / cli / src / cli / bitrix.adjust.js View on Github external
}

	if (!fs.existsSync(`${params.path}.backup`)) {
		fs.copyFileSync(params.path, `${params.path}.backup`);
	}

	const hgrc = ini.parse(fs.readFileSync(params.path, 'utf-8'));

	if (!('hooks' in hgrc)) {
		hgrc.hooks = {};
	}

	hgrc.hooks['preupdate.bitrix.build.watcher'] = preUpdateHandler;
	hgrc.hooks['update.bitrix.build.watcher'] = updateHandler;

	const encodedHgrc = ini.encode(hgrc);

	fs.writeFileSync(params.path, encodedHgrc);

	if (!argv.silent && params.silent !== true) {
		// eslint-disable-next-line
		Logger.log(`${params.path} updated`.green.bold);
	}
}
github microsoft / azure-pipelines-tasks / Tasks / TwineAuthenticateV1 / twineauthenticatemain.ts View on Github external
function formPypircFormatFromData(authInfo: auth.AuthInfo[]): string{
    let ent : {} = {};

    let header = util.format("[distutils]%sindex-servers=", os.EOL);

    for(let entry of authInfo) {
        console.log(tl.loc("Info_AddingAuthForRegistry", entry.packageSource.feedName));

        if (entry.packageSource.feedName in ent){
            throw new Error(tl.loc("Error_DuplicateEntryForExternalFeed",
                    entry.packageSource.feedName));
        }
        header += util.format("%s ", entry.packageSource.feedName);
        ent[entry.packageSource.feedName] = new Repository(entry.packageSource.feedUri, entry.username, entry.password);
    }
    let encodedStr = ini.encode(ent);

    header = header + os.EOL + encodedStr;
    return header;
}
github RedDuckss / CemUI / app.js View on Github external
ipcMain.on('update_game_settings', (event, data) => {
	var id = data.rom.toLowerCase().replace('-', ''),
		settings = data.settings,
		valid_games = game_storage.get('games').filter({title_id: data.rom}).value(),
		instance = settings_storage.get('cemu_paths').find({name: data.emu}).value();

	if (!valid_games || !instance) {
		return;
	}
	
	for (var i=0;i
github npm / npm-profile / cmds / util / npmrc.js View on Github external
function write (file, conf) {
  delete conf.auth
  delete conf.creds
  return writeFile(file, ini.encode(conf))
}
github realm / realm-js / scripts / download-realm.js View on Github external
function writeLockfile(target, contents) {
    return fs.writeFile(path.resolve(target, LOCKFILE_NAME), ini.encode(contents));
}
github zumwald / better-vsts-npm-auth / lib / npm.ts View on Github external
return new Promise((resolve, reject) => {
      fs.writeFile(this.filePath, ini.encode(this.settings), err => {
        if (err) {
          reject(err);
        } else {
          resolve();
        }
      });
    });
  }

ini

An ini encoder/decoder for node

ISC
Latest version published 2 months ago

Package Health Score

92 / 100
Full package analysis