How to use the jsonfile.readFileSync function in jsonfile

To help you get started, we’ve selected a few jsonfile 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 krhoyt / IBM / bluemix / websocket / server / app.js View on Github external
// Constant
var BARCODE_REMOVE = 'barcode_remove';
var BARCODE_SHOW = 'barcode_show';
var BUILDINGS_VALUE = 'buildings';
var CHAT_CREATE = 'create_chat';
var CHAT_READ_ALL = 'read_all_chat';
var PETROLPAL_VALUE = 'petropal';
var PHOTOCELL_VALUE = 'photocell';
var TETRIS_DOWN = 'tetris_down';
var TETRIS_JOIN = 'tetris_join';
var TETRIS_UP = 'tetris_up';

// Environment
var environment = cfenv.getAppEnv();
var configuration = jsonfile.readFileSync( path.join( __dirname, 'configuration.json' ) );

// Database
mongoose.connect( configuration.compose );

mongoose.connection.on( 'connected', function() {
    console.log( 'Connected to Compose.' );
} );

// Models
var Chat = require( path.join( __dirname, 'models/chat' ) );

// Web
var app = express();

// Middleware
app.use( parser.json() );
github joelpurra / talkie / src / split-environments / node / manifest-provider.js View on Github external
getSync() {
        // NOTE: making sure it's a synchronous call.
        // https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/getManifest
        if (this.manifest === null) {
            /* eslint-disable no-sync */
            this.manifest = jsonfile.readFileSync(MANIFEST_FILENAME);
            /* eslint-enable no-sync */
        }

        return this.manifest;
    }
}
github krhoyt / IBM / shackcaddy / server / app.js View on Github external
// Constants
var ESRI_GEOCODE = 'find';
var ESRI_REVERSE = 'reverseGeocode';
var ESRI_URI = 'http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer';
var LANGUAGE = 'en-US';
var UNITS = 'e';
var WEATHER_CURRENT = 'api/weather/v2/observations/current';
var WEATHER_FORECAST = 'api/weather/v2/forecast/daily/10day';

// Load Weahter Insight credentials
// From Bluemix configuration or local file
if( process.env.VCAP_SERVICES ) {
    var environment = JSON.parse( process.env.VCAP_SERVICES );
    var credentials = environment['weatherinsights'][0].credentials;    
} else {
    var credentials = jsonfile.readFileSync( 'configuration.json' );
}

// Authentication
passport.use( new ImfBackendStrategy() );

// Web server
var app = express();
app.use( passport.initialize() );

// Root redirects to public content
app.get( '/', function( req, res ) {
	res.sendfile( 'public/index.html' );
} );

// Public static content
app.use( '/public', express.static( __dirname + '/public' ) );
github EYBlockchain / nightfall / zkp / src / f-token-controller.js View on Github external
import Element from './Element';
import Web3 from './web3';
import { getTruffleContractInstance } from './contractUtils';

const FTokenShield = contract(jsonfile.readFileSync('./build/contracts/FTokenShield.json'));
FTokenShield.setProvider(Web3.connect());

const VerifierRegistry = contract(
  jsonfile.readFileSync('./build/contracts/Verifier_Registry.json'),
);
VerifierRegistry.setProvider(Web3.connect());

const Verifier = contract(jsonfile.readFileSync('./build/contracts/GM17_v0.json'));
Verifier.setProvider(Web3.connect());

const FToken = contract(jsonfile.readFileSync('./build/contracts/FToken.json'));
FToken.setProvider(Web3.connect());

const shield = {}; // this field holds the current Shield contract instance.

async function unlockAccount(address, password) {
  const web3 = Web3.connection();
  await web3.eth.personal.unlockAccount(address, password, 0);
}

/**
This function allocates a specific FTokenShield contract to a particular user
(or, more accurately, a particular Ethereum address)
@param {string} shieldAddress - the address of the shield contract you want to point to
@param {string} address - the Ethereum address of the user to whom this shieldAddress will apply
*/
async function setShield(shieldAddress, address) {
github shlomiassaf / tdm / scripts / build_lib.js View on Github external
function runMeta() {
  const meta = metadata.shift();

  if (meta) {
    console.log(`Compiling ${meta.dir}\n`);

    const tsConfig = meta.tsConfigUpdate( jsonfile.readFileSync(root(`tsconfig.package.json`)) );
    jsonfile.writeFileSync(root('.tsconfig.tmp.json'), tsConfig, {spaces: 2});

    Object.assign(meta, {tsConfig: './.tsconfig.tmp.json'});
    const config = resolveConfig(root('config/webpack.package.js'), meta);

    console.log(`Include: ${tsConfig.include.join(', ')}\n`);
    console.log(`OutDir: ${tsConfig.compilerOptions.outDir}\n`);

    return runWebpack(config)
      .done
      .then( () => {
        let p = root(tsConfig.compilerOptions.outDir);
        if (!p.endsWith(`/${meta.dir}`)) {
          p = path.join(p, meta.dir);
        }
github babsey / nest-desktop / src / lib / sync.js View on Github external
}).map((file) => {
        var name = file.split('.')[0]
        var sim = jsonfile.readFileSync(path.join(app.dataPath, 'simulations', name + '.json'))
        app.db.localDB.findOne({
            _id: sim._id
        }).exec((err, docs) => {
            sim.version = app.config.app().version;
            if (docs == null) {
                app.db.localDB.insert(sim)
            } else if (app.hash(docs) != app.hash(sim)) {
                app.db.localDB.update({
                    _id: docs._id
                }, sim)
            }
        })
    })
}
github bikenik / alfred-reverso / src / index.js View on Github external
async function main() {
	setupDirStructure()
	let inputCollection = jsonfile.readFileSync(config.input)
	inputCollection = joinTheSameItems(inputCollection)
	const cleanedInput = cleanInput(inputCollection)
	const check = await canAddNotes(cleanedInput)
	const output = check[0] ? await processInput(cleanedInput) : cleanedInput.map(x => {
		return [{
			Headword: `${x.Headword}${x.Homnum ? `<span class="HOMNUM-title">${
				x.Homnum.toString()}</span>` : ''}`,
			Audio: '',
			Translation: '',
			Example: '',
			Image: '',
			Verb_table: '',
			Tag: [x.Part_of_speech]
		}]
	})[0]
	await ankiAddCard(output)
github DivanteLtd / vue-storefront / core / scripts / all.js View on Github external
static isBackendInstalledLocally () {
    if (typeof installer.Abstract.wasLocalBackendInstalled === 'undefined') {
      let config = jsonFile.readFileSync(installer.TARGET_BACKEND_CONFIG_FILE)

      installer.Abstract.wasLocalBackendInstalled = Boolean(config.install.is_local_backend)
    }

    return Boolean(installer.Abstract.wasLocalBackendInstalled)
  }
github fossasia / open-event-wsgen / src / backend / generator.js View on Github external
function getJsonData(reqOpts, next) {
  try {
    const appFolder = reqOpts.email + '/' + fold.slugify(reqOpts.name);
    const distJsonsPath = distHelper.distPath + '/' + appFolder + '/json';
    const sessionsData = jsonfile.readFileSync(distJsonsPath + '/sessions');
    const speakersData = jsonfile.readFileSync(distJsonsPath + '/speakers');
    const eventData = jsonfile.readFileSync(distJsonsPath + '/event');
    const sponsorsData = jsonfile.readFileSync(distJsonsPath + '/sponsors');
    const tracksData = jsonfile.readFileSync(distJsonsPath + '/tracks');
    const roomsData = jsonfile.readFileSync(distJsonsPath + '/microlocations');

    return transformData(sessionsData, speakersData, eventData, sponsorsData, tracksData, roomsData, reqOpts, function(data) {
      next(null, data);
    });
  } catch (err) {
    return next(err);
  }
}
github seattleio / seattle-boundaries-data / data / index.js View on Github external
var jsonfile = require('jsonfile')

module.exports = {
  'census-tracts': jsonfile.readFileSync(__dirname + '/census-tracts.geojson'),
  'city-council-districts': jsonfile.readFileSync(__dirname + '/city-council-districts.geojson'),
  'city-limits': jsonfile.readFileSync(__dirname + '/city-limits.geojson'),
  congress: jsonfile.readFileSync(__dirname + '/seattle-congress.geojson'),
  neighborhoods: jsonfile.readFileSync(__dirname + '/neighborhoods.geojson'),
  parks: jsonfile.readFileSync(__dirname + '/seattle-parks-osm.geojson'),
  'sps-es': jsonfile.readFileSync(__dirname + '/sps_attendance_area_ES.geojson'),
  'sps-hs': jsonfile.readFileSync(__dirname + '/sps_attendance_area_HS.geojson'),
  'sps-ms': jsonfile.readFileSync(__dirname + '/sps_attendance_area_MS.geojson'),
  'wa-legislature': jsonfile.readFileSync(__dirname + '/seattle-waleg.geojson'),
  'zip-codes': jsonfile.readFileSync(__dirname + '/zip-codes.geojson'),
  'spd-beats': jsonfile.readFileSync(__dirname + '/spd-beats.geojson'),
  'spd-precincts': jsonfile.readFileSync(__dirname + '/spd-precincts.geojson'),
  'spd-mcpp-areas': jsonfile.readFileSync(__dirname + '/spd-mcpp-areas.geojson'),
  'zoning': jsonfile.readFileSync(__dirname + '/zoning.geojson')
}