Skip to content

Commit 85344c3

Browse files
authored
Merge branch 'develop' into dependabot/npm_and_yarn/form-data-4.0.4
2 parents 018eb36 + 4f77e7b commit 85344c3

File tree

9 files changed

+280
-295
lines changed

9 files changed

+280
-295
lines changed

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ jobs:
5353
# Upload the results to GitHub's code scanning dashboard (optional).
5454
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
5555
- name: 'Upload to code-scanning'
56-
uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
56+
uses: github/codeql-action/upload-sarif@5d5cd550d3e189c569da8f16ea8de2d821c9bf7a # v3.31.2
5757
with:
5858
sarif_file: results.sarif

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "alasql",
33
"description": "Use SQL to select and filter javascript data - including relational joins and search in nested objects (JSON). Export to and import from Excel and CSV",
4-
"version": "4.6.6",
4+
"version": "4.7.0",
55
"author": "Andrey Gershun <[email protected]>",
66
"contributors": [
77
"Mathias Wulff <[email protected]>"
@@ -52,17 +52,17 @@
5252
"blueimp-md5": "2.19.0",
5353
"cmdmix": "2.2.2",
5454
"dom-storage": "2.1.0",
55-
"esbuild": "0.25.2",
55+
"esbuild": "0.25.12",
5656
"git-branch-is": "4.0.0",
5757
"husky": "9.1.7",
5858
"jison": "^0.4.18",
59-
"mocha": "11.1.0",
59+
"mocha": "11.7.4",
6060
"mocha.parallel": "0.15.6",
61-
"open": "10.1.1",
62-
"prettier": "3.5.3",
61+
"open": "10.2.0",
62+
"prettier": "3.6.2",
6363
"react-native-fetch-blob": "^0.10.8",
6464
"react-native-fs": "^2.20.0",
65-
"rexreplace": "7.1.12",
65+
"rexreplace": "7.1.13",
6666
"strftime": "0.10.3",
6767
"tabletop": "1.6.3",
6868
"uglify-js": "3.19.3"

src/15utility.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,19 @@ async function fetchData(path, success, error, async) {
442442
}
443443

444444
function getData(path, success, error) {
445+
return _fetch(path)
446+
.then(response => response.text())
447+
.then(txt => {
448+
success(txt);
449+
})
450+
.catch(e => {
451+
if (error) return error(e);
452+
console.error(e);
453+
throw e;
454+
});
455+
}
456+
457+
function getBinaryData(path, success, error) {
445458
return _fetch(path)
446459
.then(response => response.arrayBuffer())
447460
.then(buf => {
@@ -481,7 +494,7 @@ var loadBinaryFile = (utils.loadBinaryFile = function (
481494
fs = require('fs');
482495

483496
if (/^[a-z]+:\/\//i.test(path)) {
484-
fetchData(path, success, error, runAsync);
497+
return getBinaryData(path, success, error);
485498
} else {
486499
if (runAsync) {
487500
fs.readFile(path, function (err, data) {

test/test157.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('Test 157 - json()', function () {
1010
it('1. Load text data from file async', function (done) {
1111
alasql('select * from json("' + __dirname + '/test157.json")', [], function (res) {
1212
// console.log(13,res);
13-
assert.deepEqual(res, [{a: 1}, {a: 2}]);
13+
assert.deepEqual(res, [{a: 1}, {a: 2}, {c: '😂'}]);
1414
done();
1515
});
1616
});

test/test157.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"a": 1}, {"a": 2}]
1+
[{"a": 1}, {"a": 2}, {"c": "😂"}]

test/test2112.dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test/test2112.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
if (typeof exports === 'object') {
2+
var assert = require('assert');
3+
var alasql = require('..');
4+
}
5+
6+
describe('Test 2112 - load binary file', function () {
7+
const test = '2112'; // insert test file number
8+
9+
it('A) Loads binary file (sync)', function () {
10+
alasql.utils.loadBinaryFile('./test/test' + test + '.dat', false, function (data) {
11+
assert.equal(data, '�');
12+
});
13+
});
14+
15+
it('B) Loads binary file (async)', function (done) {
16+
alasql.utils.loadBinaryFile('./test/test' + test + '.dat', true, function (data) {
17+
assert.equal(data, '�');
18+
done();
19+
});
20+
});
21+
22+
it('C) Loads HTTPS binary file (async)', function (done) {
23+
alasql.utils.loadBinaryFile('https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg', true, function (data) {
24+
assert.equal(data.slice(0, 3), 'ÿØÿ');
25+
done();
26+
});
27+
});
28+
});

test/test418.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ if (typeof exports === 'object') {
88
Test for issue #379
99
*/
1010

11+
let baseUrl = "github.com/AlaSQL/alasql/raw/refs/heads/develop"
12+
1113
var test = 418;
1214

1315
describe('Test ' + test + ' Load data from internet', function () {
@@ -38,7 +40,7 @@ describe('Test ' + test + ' Load data from internet', function () {
3840
}
3941

4042
describe('.xlsx from URL', function () {
41-
var url = 'raw.githubusercontent.com/agershun/alasql/develop/test/test411.xlsx';
43+
var url = baseUrl + '/test/test411.xlsx';
4244

4345
it('Load http', function (done) {
4446
this.timeout(10000);
@@ -52,7 +54,7 @@ describe('Test ' + test + ' Load data from internet', function () {
5254
});
5355

5456
describe('.xls from URL', function () {
55-
var url = 'raw.githubusercontent.com/agershun/alasql/develop/test/test168.xls';
57+
var url = baseUrl + '/test/test168.xls';
5658

5759
it('Load http', function (done) {
5860
this.timeout(10000);
@@ -66,21 +68,21 @@ describe('Test ' + test + ' Load data from internet', function () {
6668
});
6769

6870
describe('.json from URL', function () {
69-
var url = 'raw.githubusercontent.com/agershun/alasql/develop/test/test157.json';
71+
var url = baseUrl + '/test/test157.json';
7072

7173
it('Load http', function (done) {
7274
this.timeout(2000);
73-
testRequest(2, 'http://' + url, 'false', done);
75+
testRequest(3, 'http://' + url, 'false', done);
7476
});
7577

7678
it('Load https', function (done) {
7779
this.timeout(10000);
78-
testRequest(2, 'https://' + url, 'false', done);
80+
testRequest(3, 'https://' + url, 'false', done);
7981
});
8082
});
8183

8284
xdescribe('.tab from URL', function () {
83-
var url = 'raw.githubusercontent.com/agershun/alasql/develop/test/test157.tab';
85+
var url = baseUrl + '/test/test157.tab';
8486

8587
it('Load http', function (done) {
8688
this.timeout(10000);
@@ -94,7 +96,7 @@ describe('Test ' + test + ' Load data from internet', function () {
9496
});
9597

9698
describe('.txt from URL', function () {
97-
var url = 'raw.githubusercontent.com/agershun/alasql/develop/test/test157.txt';
99+
var url = baseUrl + '/test/test157.txt';
98100

99101
it('Load http', function (done) {
100102
this.timeout(10000);
@@ -108,7 +110,7 @@ describe('Test ' + test + ' Load data from internet', function () {
108110
});
109111

110112
describe('.csv from URL', function () {
111-
var url = 'raw.githubusercontent.com/agershun/alasql/develop/test/test157a.csv';
113+
var url = baseUrl + '/test/test157a.csv';
112114

113115
it('Load http', function (done) {
114116
this.timeout(10000);

0 commit comments

Comments
 (0)