Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@dannadori/asciiart-worker-js
Advanced tools
This is webworker module for AsciiArt.
$ npm install \@dannadori/asciiart-worker-js
generateAsciiArtDefaultConfig: () => AsciiConfig;
generateDefaultAsciiArtParams: () => AsciiOperationParams;
AsciiArtWorkerManager
init: (config: AsciiConfig | null) => Promise<unknown>;
predict(targetCanvas: HTMLCanvasElement, params: AsciiOperationParams): Promise<HTMLCanvasElement>;
export interface AsciiConfig{
browserType : BrowserType
processOnLocal : boolean
}
export interface AsciiOperationParams{
type: AsciiFunctionType
processWidth : number
processHeight : number
asciiStr : string
fontSize : number
}
export enum AsciiFunctionType{
AsciiArt
}
$ npx create-react-app demo --template typescript
$ cd demo/
$ npm install
$ npm install @dannadori/asciiart-worker-js
In this time, the name is "srcImage.jpg"
Sample code is here.
import React from 'react';
import './App.css';
import { AsciiArtWorkerManager, generateAsciiArtDefaultConfig, generateDefaultAsciiArtParams } from '@dannadori/asciiart-worker-js'
class App extends React.Component{
manager = new AsciiArtWorkerManager()
config = generateAsciiArtDefaultConfig()
params = generateDefaultAsciiArtParams()
srcCanvas = document.createElement("canvas")
dstCanvas = document.createElement("canvas")
componentDidMount = () =>{
document.getRootNode().lastChild!.appendChild(this.srcCanvas)
document.getRootNode().lastChild!.appendChild(this.dstCanvas)
const srcImage = document.createElement("img")
srcImage.onload = () =>{
this.manager.init(this.config).then(()=>{
this.srcCanvas.getContext("2d")!.drawImage(
srcImage, 0, 0, this.srcCanvas.width, this.dstCanvas.height)
return this.manager.predict(this.srcCanvas, this.params)
}).then((res)=>{
console.log(res)
this.dstCanvas.getContext("2d")!.drawImage(res, 0, 0, this.dstCanvas.width, this.dstCanvas.height)
})
}
srcImage.src = "./srcImage.jpg"
}
render = ()=>{
return (
<div className="App">
</div>
);
}
}
export default App;
$ npm run start
FAQs
This is webworker module for AsciiArt.
We found that @dannadori/asciiart-worker-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.