Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
readFile(resolve(path), (err, buffer) => {
if (err) return console.error(err);
engine = FiltersEngine.deserialize(buffer);
/*const { networkFilters, cosmeticFilters } = parseFilters(
data,
engine.config,
);
engine.update({
newNetworkFilters: networkFilters,
newCosmeticFilters: cosmeticFilters,
});*/
});
}
readFile(resolve(path), (err, buffer) => {
if (err) return console.error(err);
try {
engine = FiltersEngine.deserialize(buffer);
} catch (e) {
downloadFilters();
}
/*const { networkFilters, cosmeticFilters } = parseFilters(
data,
engine.config,
);
engine.update({
newNetworkFilters: networkFilters,
newCosmeticFilters: cosmeticFilters,
});*/
});
} else {
deserialize(serialized) {
this.engine = FiltersEngine.deserialize(serialized);
}
export function benchEngineDeserialization({
serialized,
}: {
serialized: Uint8Array | undefined;
}): FiltersEngine | undefined {
if (serialized !== undefined) {
return FiltersEngine.deserialize(serialized);
}
return undefined;
}