Skip to content

Instantly share code, notes, and snippets.

@adamculpepper
Last active April 25, 2020 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamculpepper/88f3d973672705c4d09ef81767932340 to your computer and use it in GitHub Desktop.
Save adamculpepper/88f3d973672705c4d09ef81767932340 to your computer and use it in GitHub Desktop.
Puppeteer - Read Local File
const puppeteer = require('puppeteer');
const fs = require('fs');
const util = require('util');
// data
const rawdata = fs.readFileSync('plates.json');
const textDecoder = new util.TextDecoder('utf-8');
const stringData = textDecoder.decode(rawdata);
const objects = JSON.parse(stringData);
console.log(objects);
const puppeteer = require('puppeteer');
const fs = require('fs');
var fileContent = fs.readFileSync('file.txt', 'utf8');
console.log(fileContent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment