This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://nodejs.org/api/readline.html#readline_example_read_file_stream_line_by_line | |
const fs = require('fs'); | |
const readline = require('readline'); | |
const rl = readline.createInterface({ | |
input: fs.createReadStream('arquivo.tsv'), | |
crlfDelay: Infinity | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Demo: https://henriquevianna.com/simple/ | |
Based on https://blog.koley.in/baserock/ | |
*/ | |
@import url('https://fonts.googleapis.com/css?family=Fira+Sans'); | |
body { | |
font-family: 'Fira Sans', sans-serif; | |
line-height: 1.6; | |
color: #222; | |
max-width: 40rem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch( 'image.svg' ) | |
.then( response => response.text() ) | |
.then( content => { | |
const doc = new DOMParser().parseFromString( content, 'text/xml' ), | |
svg = doc.querySelector('svg'); | |
svg.setAttribute( 'fill', '#d20a11' ); | |
document.getElementById('image-container').append( svg ); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// thanks https://levelup.gitconnected.com/draw-an-svg-to-canvas-and-download-it-as-image-in-javascript-f7f7713cf81f | |
const canvas = document.getElementById('canvas'), | |
ctx = canvas.getContext('2d'), | |
svgEl = document.getElementById('mysvg'); | |
const image = new Image(); | |
image.src = URL.createObjectURL( new Blob( [ svgEl.outerHTML ], { type: 'image/svg+xml;charset=utf-8' } ) ); | |
image.onload = () => { | |
ctx.drawImage( image, 0, 0 ); |