Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Parser.prototype.parseFile = function(filename, encoding) {
var self = this;
if (typeof(encoding) === 'undefined')
encoding = 'utf8';
app.log.debug('inspect file: ' + filename);
self.filename = filename;
self.extension = path.extname(filename).toLowerCase();
// TODO: Not sure if this is correct. Without skipDecodeWarning we got string errors
// https://github.com/apidoc/apidoc-core/pull/25
var fileContent = fs.readFileSync(filename, { encoding: 'binary' });
iconv.skipDecodeWarning = true;
self.src = iconv.decode(fileContent, encoding);
app.log.debug('size: ' + self.src.length);
// unify line-breaks
self.src = self.src.replace(/\r\n/g, '\n');
self.blocks = [];
self.indexApiBlocks = [];
// determine blocks
self.blocks = self._findBlocks();
if (self.blocks.length === 0)
return;
app.log.debug('count blocks: ' + self.blocks.length);
'use strict';
const fs = require('fs');
const os = require('os');
const iconv = require('iconv-lite');
const pty = require('node-pty');
const stripAnsi = require('strip-ansi');
iconv.skipDecodeWarning = true;
module.exports = io => {
io.on('connection', socket => {
/**
* Usuário se conectou então nós criamos o terminal e definimos a trava (listen)
*/
console.log('Usuário conectado!');
let listen = false;
const shell_location = `${__dirname}/runtime/dist`;
const shell = `${shell_location}/portugol-runtime` + (os.platform() === 'win32' ? '.exe' : '');
let term;
console.log(`Iniciando em ${shell}`);
try {
term = pty.spawn(shell, [''], {
var AbstractScraper = require("./AbstractScraper"),
config = require("../config"),
request = require("request-promise"),
cheerio = require("cheerio"),
urlLib = require("url"),
moment = require("moment"),
iconv = require("iconv-lite");
iconv.skipDecodeWarning = true;
module.exports = class ImmonetScraper extends AbstractScraper {
constructor(db) {
super(db, "immonet");
this.cookieJar = request.jar();
}
_isAngebot(tableRow) {
return true;
}
_isVermietetByTableRow() {
return false; //unfortunately we cannot get this from the table row, we need to update it via updateItems
}
_getNextPage(url, $) {
const nextLink = $(".pagination-wrapper+a[href]");
if (nextLink.length > 0) {
return urlLib.resolve(url, nextLink.attr("href"));
} else {
var AbstractScraper = require("./AbstractScraper"),
config = require("../config"),
request = require("request-promise"),
cheerio = require("cheerio"),
urlLib = require("url"),
moment = require("moment"),
iconv = require("iconv-lite");
iconv.skipDecodeWarning = true;
module.exports = class WgGesuchtScraper extends AbstractScraper {
constructor(db) {
super(db, "studentenWg");
this.cookieJar = request.jar();
}
_isAngebot(tableRow) {
var id = tableRow.attr("id");
if (id != null && id.indexOf("wg-ergrow") === 0) {
return true;
}
return false;
}
_isVermietetByTableRow() {
return false; //unfortunately we cannot get this from the table row, we need to update it via updateItems
}
fn: function (buf, code, sys) {
const iconv = require('iconv-lite')
iconv.skipDecodeWarning = true
return iconv.decode(Buffer.from(buf), code)
}
},