Relative Content

Tag Archive for javascriptweb

Is there a standardised way to read a csv buffer into an array of Javascript objects in the browser?

Let’s say you have a website that makes a fetch request to the server and gets back a CSV list. Now I want to parse the CSV values into an array of Javascript objects. Most places I’ve searched point to using Papa parse, but that’s an external library that I have to provide. Is there an standardised way to do this in a browser? In other words does the browser provide this facility by default or do I have to introduce an external dependency served to the website?

Get data from external file

I’m working in vanilla JS (I might convert the code to JQuery but we’ll see) and I’d like to have a file in the same folder as the JS file (this file would be publicly accessible) simply containing a bunch of data for the JS script to work with. I’d rather not have all the data hard-coded into the script for a number of reasons.

Getting content from several table pages from a website

const puppeteer = require(‘puppeteer’); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); // Navigate to the page await page.goto(‘https://www.sharkscope.com/#Find-Tournament//networks/888Poker(ES-PT)/tournaments/252404158’); // Wait for the first selector to be available let selectorIndex = 1; const extractedContent = {}; while (true) { const selector = `#jqg${selectorIndex}`; const selectorExists = await page.waitForSelector(`${selector} > […]