New functions:
k8_read_file()
: read an entire file as an ArrayBufferk8_decode()
: convert an ArrayBuffer/Bytes object to a stringk8_encode()
: convert a string to an ArrayBufferk8_revcomp()
: reverse complement a DNA sequence
Improved:
Bytes.read()
: allow to read the rest of a file
(1.2: 27 May 2024, r137)
This version sets v8's default max_old_space_size
to 16 GB and also adds
option -m
as a more convenient way to change this parameter.
(1.1: 26 May 2024, r129)
The previous version of k8, v0.2.5, was built on top of v8-3.16.4 released on 2013-01-11. This version updates v8 to v8-10.2.154.26 released on 2023-01-23, ten years later. It brings ES6 features including but not limited to the "let" keyword to define local variables, Java-like classes and back-tick strings.
Due to the lack of the SetIndexedPropertiesToExternalArrayData() API in v8, it is not possible to keep full backward compatibility with older k8 versions. Nonetheless, we have tried to retain commonly used methods such that several popular k8 scripts can mostly work.
New functions:
k8_version()
: get the k8 versionBytes.buffer
: get ArrayBuffer
Improved:
load()
: search the script pathprint()
: print to stdout. Support ArrayBuffer. Faster for Bytes.warn()
: print to stderr. Support ArrayBuffer. Faster for Bytes.
Mostly unchanged:
exit()
: exitBytes.length
: get/set Bytes lengthBytes.capacity
: get/set Bytes capacitynew File()
: open a fileFile.prototype.close()
: close the file handlerFile.prototype.read()
: read a byte or bytesFile.prototype.readline()
: read a lineFile.prototype.write()
: write to a plain file
Changed functions (BREAKING):
new Bytes()
- Bytes only supportsuint8_t
nowBytes.prototype.set()
- Bytes only supportsuint8_t
Removed functions (BREAKING):
Map
- JavaScript hasMap
and works betterBytes.prototype.cast()
- Bytes only supportsuint8_t
Bytes[]
- not possible to implement. UseBytes.buffer
as a partial remedy
(1.0: 10 August 2023, r124)