小编Adr*_*ria的帖子

JavaScript CRC32

我正在寻找CRC32 的现代 JavaScript实现.

此实现,这可能起源于这里,现在这里无处不在,是不可接受的,因为它的速度慢(500毫秒/ MB),并在空格分隔表的2KB取决于使用SUBSTR访问.呸!

CRC32似乎有一些变化,所以我需要匹配这个输出:

mysql> SELECT CRC32('abcde');
> 2240272485
Run Code Online (Sandbox Code Playgroud)

然而,函数实际上不需要接受字符串,因为我正在使用字节数组.

javascript crc32 checksum

35
推荐指数
5
解决办法
3万
查看次数

在ServiceWorker中访问indexedDB.比赛条件

在ServiceWorker中展示indexedDB的示例并不多,但我看到的结构都是这样的:

const request = indexedDB.open( 'myDB', 1 );
var db;

request.onupgradeneeded = ...

request.onsuccess = function() {
    db = this.result; // Average 8ms
};


self.onfetch = function(e)
{
    const requestURL = new URL( e.request.url ),
    path = requestURL.pathname;

    if( path === '/test' )
    {
        const response = new Promise( function( resolve )
        {
            console.log( performance.now(), typeof db ); // Average 15ms

            db.transaction( 'cache' ).objectStore( 'cache' ).get( 'test' ).onsuccess = function()
            {
                resolve( new Response( this.result, { headers: { 'content-type':'text/plain' } …
Run Code Online (Sandbox Code Playgroud)

html5 indexeddb service-worker

8
推荐指数
2
解决办法
8286
查看次数

标签 统计

checksum ×1

crc32 ×1

html5 ×1

indexeddb ×1

javascript ×1

service-worker ×1