
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
angular-web-sqlite
Advanced tools
angular-web-sqlite is an Angular service that wraps the @sqlite.org/sqlite-wasm module. This Angular service takes care of the declaration and communication with a web worker, essential for utilizing the Origin Private File System (OPFS) storage back-en
angular-web-sqlite is an Angular service that wraps the @sqlite.org/sqlite-wasm module. This Angular service takes care of the declaration and communication with a web worker, essential for utilizing the Origin Private File System (OPFS) storage back-end.
Install the library using npm:
npm install angular-web-sqlite
The installation of the module modifies the angular.json file to incorporate precompiled files.
This setup guarantees that the essential assets—the SQLite working script (sqlite-worker.js) and files from the @sqlite.org/sqlite-wasm module, utilized by the library internally—are included in the output directory during the build process.
Ensure that the 'sqlite-client' folder is copied to the project's output directory, www.
"projects": {
"app": {
...
"architect": {
...
"build": {
...
"options": {
"assets": [
...
{
"glob": "**/*.js",
"input": "./node_modules/angular-web-sqlite/src/lib/assets",
"output": "./sqlite-client/"
},
{
"glob": "**/*",
"input": "./node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/",
"output": "./sqlite-client/"
}
]
}
...
},
"serve": {
...
"options": {
...
"headers": {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp"
}
}
}
}
}
}
init(dbName: string): Promise<any> //Initializes the SQLite database with the specified name.
executeSql(sql: string, params: any[]): Promise<any> //Executes a single SQL query with optional parameters.
batchSql(sqls: [index: number]: [string, any[]]): Promise<any> //Executes a batch of SQL statements as a transaction.
import { WebSqlite } from 'angular-web-sqlite';
@Injectable()
export class YourService {
constructor(
private webSqlite: WebSqlite
) { }
async initializeDatabase(dbName: string) {
await this.webSqlite.init(dbName);
}
async executeQuery() {
const sql = 'SELECT * FROM your_table';
const params = [];
const result = await this.webSqlite.executeSql(sql, params);
// Process the result as needed
}
async batchSqlOperations() {
const sqls = [
["CREATE TABLE IF NOT EXISTS your_table (a TEXT, b TEXT)", []],
["CREATE TABLE IF NOT EXISTS your_table2 (c TEXT, d TEXT)", []],
....];
const result = await this.webSqlite.batchSql(sqls);
// Process the result as needed
}
}
FAQs
angular-web-sqlite is an Angular service that wraps the @sqlite.org/sqlite-wasm module. This Angular service takes care of the declaration and communication with a web worker, essential for utilizing the Origin Private File System (OPFS) storage back-en
The npm package angular-web-sqlite receives a total of 13 weekly downloads. As such, angular-web-sqlite popularity was classified as not popular.
We found that angular-web-sqlite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.