You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
ChatGPTでは、全ての回答の生成を待たずに、回答が順次画面に表示されていきます。 実は、OpenAIのChat APIを使う場合も、同じ挙動を実現できます。 アプリの例 方法1. ブラウザで直接OpenAI APIを叩く 以下の記事で紹介されているように、ブラウザのFetch APIを使って直接OpenAIの APIを叩く方法が一番シンプルにできそうです。 注意点として、APIキーがユーザーに知られるため、ユースケースが限られそうです。 方法2. Node.jsのサーバーを介してOpenAI APIを叩く 今回は、以下のように中間にNode.jsのサーバーを挟む例を示します。 Step1. Node.jsサーバーの実装 ※注意点として、サーバーは text/event-stream 形式のレスポンスを返す必要があり、 Next.js API Routes + VercelやAWS Am
「東京Node学園」は、Node.js日本ユーザグループ主催のNode.js勉強会です。36時限目の今回は、オンラインで開催されました。 Funaoka氏は、Rustでネイティブモジュールを作る方法について発表しました。 ネイティブモジュールを書く理由 Yukimasa Funaoka氏(以下、Funaoka):まず、自己紹介をします。私は、株式会社ディー・エヌ・エーでフロントエンドの業務をしている、船岡と申します。 本日は、どういった目的でネイティブモジュールを書くのか、具体的にRustで作るにはどうすればよいのか、そしてクロスプラットフォーム対応と、実際に書いてみて困ったことなどを紹介したいと思っています。 まず、ネイティブモジュールを書く理由ですが、ネイティブモジュールは、JS(JavaScript)の世界を超えて、ネイティブのバイナリとNode(Node.js)との架け橋になって、
どうもこんにちは。筆者はここ1年くらいnitrogqlというTypeScript + GraphQL向けコード生成ツールを開発しています。(初手宣伝) このツールの本体はRustで書かれており、コンパイルするとWASMバイナリが生成されます。このWASMバイナリをNode.jsから呼び出すようなラッパーを作って、コマンドラインツールとしてnpmで公開しています。 その性質上、Node.js側とWASM側で通信(データのやり取り)が発生します。特に、設定ファイルなどが.jsや.tsで書かれていても読み込む機能があり、その際はRust側からNode.js側に制御を渡してNode.js側でファイルを読み込み、結果をRust側に返すようになっています。 実は、nitrogqlの(Rust側)コードにはこれまで非同期処理が含まれていませんでした。しかし、パフォーマンスのことなどを考えると非同期処理に
Today, we are excited to announce a preview of improved Node.js compatibility for Workers and Pages. Broader compatibility lets you use more NPM packages and take advantage of the JavaScript ecosystem when writing your Workers. Our newest version of Node.js compatibility combines the best features of our previous efforts. Cloudflare Workers have supported Node.js in some form for quite a while. We
Notable Changes Experimental Web Streams API Node.js now exposes an experimental implementation of the Web Streams API. While it is experimental, the API is not exposed on the global object and is only accessible using the new stream/web core module: import { ReadableStream, WritableStream } from 'stream/web'; // Or from 'node:stream/web' Importing the module will emit a single experimental warnin
Node.js is maturing. Many patterns and frameworks were embraced - it's my belief that developers' productivity dramatically increased in the past years. One downside of maturity is habits - we now reuse existing techniques more often. How is this a problem? In his novel book 'Atomic Habits' the author James Clear states that: "Mastery is created by habits. However, sometimes when we're on auto-pil
This blog was written by Bethany Griggs, with additional contributions from the Node.js Technical Steering Committee and project collaborators. We’re excited to announce that Node.js 17 was released today! Node.js 17 replaces Node.js 16 as our ‘current’ release line, with Node.js 16 being promoted to long-term support (LTS) next week. You can expect new releases of Node.js 17 approximately every t
Notable Changes Permission Model Node.js now has an experimental feature called the Permission Model. It allows developers to restrict access to specific resources during program execution, such as file system operations, child process spawning, and worker thread creation. The API exists behind a flag --experimental-permission which when enabled will restrict access to all available permissions. B
2024-12-10, Version 23.4.0 (Current), @aduh95 prepared by @targos Notable Changes Introducing experimental assert.partialDeepStrictEqual Sometimes, when writing test, we want to validate that some specific properties are present, and the mere presence of additional keys are not exactly relevant for that specific test. For this use case, we can now use assert.partialDeepStrictEqual, which should be
概要 この記事は「【マイスター・ギルド】本物のAdvent Calendar 2022」9日目の記事です。 まぁかくかくしかじかありまして、JavaScriptの練習としてAPIを叩いて返ってきた値(JSON)を画面に表示してみよう、そのための環境を作ろうってなったんです。 JavaScriptの練習だからフロントはもちろん使うけど、API側もNodeで書けばより理解も深まるだろうということでExpressなるフレームワークがあると知ってそれを使って環境構築をしてみました。 最近nginxの勉強もしたのでプロキシ設定を使った構成の練習台にもちょうどよかったです。 環境を作ろう 準備 こんな感じのディレクトリ構成にします。今回はデスクトップに作成しました。
Static method: Buffer.copyBytesFrom(view[, offset[, length]])
OpenJS Foundationは2024年4月25日、Node.jsの新バージョン「Node.js 22」をリリースした。 Node.js 22 is now available! -Node.js Node.js 22 Available Now | OpenJS Foundation Node.js 22 is here 😎 Featuring: require()ing ESM graphs, WebSocket client, updates of the V8 JavaScript engine, and more. Big thank you to @_rafaelgss and @satanacchio for their work on this 🎉 pic.twitter.com/yXgR8fsMqt — Node.js (@nodejs) April 24, 2
Notable Changes child_processes: add AbortSignal support (Benjamin Gruenbaum) #36308 deps: update ICU to 68.1 (Michaël Zasso) #36187 events: support signal in EventTarget (Benjamin Gruenbaum) #36258 graduate Event, EventTarget, AbortController (James M Snell) #35949 http: enable call chaining with setHeader() (pooja d.p) #35924 module: add isPreloading indicator (James M Snell) #36263 stream: supp
This summer, I upgraded a project from Node 18 to Node.js 20. The code was not that old, and I did not expect any problems... But as with every Node.js upgrade, unexpected behaviors happened. Why upgrade?It is common practice to keep projects up to date. Lagging behind too much may increase the work needed to upgrade when the choice isn’t yours anymore. I could have waited, but I had some time to
JSer.info #690 - Electron 30.0.0がリリースされました。 Electron 30.0.0 | Electron V8 12.4、Chromium 124、Node.js 20.11.1へアップデート。 File System APIをサポート、Cross Origin iframeにPermission Policyを使うように変更、WebContentsView/BaseWindowの廃止などの変更が含まれています。 Firefox 125がリリースされました。 Firefox 125.0.1, See All New Features, Updates and Fixes Firefox 125 for developers - Mozilla | MDN Intl.Segmenterのサポート、Popover APIのサポート、AV1コーデックのサポート
JSer.info #666 - Node.js 21がリリースされました。 Node.js 21 is now available! | Node.js 奇数バージョンはいわゆる開発バージョンとなりLTSにはなりません。 Node.js 21では、Fetch/WebStreams APIのStable化、V8 11.8へのアップデート、node --testでのglobのサポートが追加されています。 また、モジュールのデフォルトをESMにできる--experimental-default-type、Magic BytesでWasmを判定する--experimental-wasm-modulesの追加されています。 これらのフラグについては次の記事で解説しています。 Deep Dive: Node.jsのESMデフォルト化への道 - JSer.info また、fs.writeFileにfl
Node.jsを使用して構築されたコマンドラインインターフェース(CLI)は、広大なNode.jsのエコシステムを活用し、反復的なタスクを自動化することができます。また、npmやyarnなどのパッケージマネージャーを通じて簡単に配布でき、複数のプラットフォームで利用できます。この記事では、CLIの作成にNode.jsを使用するメリットとその方法、いくつかの便利なパッケージ、そして新しいCLIを配布する方法を解説します。 CLIの作成にNode.jsを使用する理由 Node.jsが人気を博した理由の1つは、npmレジストリに90万以上のパッケージを有するパッケージエコシステムであるという点です。Node.jsを使用してCLIを作成することで大量のCLI向けパッケージを含むエコシステムを利用することができます。たとえば、CLIで次のよ
2023-10-17, Version 21.0.0 (Current), @RafaelGSS and @targos We're excited to announce the release of Node.js 21! Highlights include updates of the V8 JavaScript engine to 11.8, stable fetch and WebStreams, a new experimental flag to change the interpretation of ambiguous code from CommonJS to ES modules (--experimental-default-type), many updates to our test runner, and more! Node.js 21 will repl
By now you've noticed nodejs.org's fresh new look! We've taken great care in approaching this design with a nod to the past and look to the future. The site has many converging use cases, thousands of pages, and is a daily resource to many. The whole story had some dead ends and detours. But in the end it was a collective effort; coming to life with the contributions of over three dozen contributo
Enter the new era of AdminJS! Our system leverages AI to effortlessly generate text. Simplify your product database management with just one click. Check demo of AdminJS Filled with tons of features The out-of-the-box version of AdminJS is pretty powerful, but its in-depth customizability is where it really shines. With a basic knowledge of React and Node.js, you can change nearly every behaviour
先日開催された OpenAI Dev Day で新たに発表された、テキストから音声を生成する OpenAI TTS (Text To Speech) API が面白そうだったので、早速ですが Node.js 環境で簡単に試してみました。 先日開催された OpenAI Dev Day では大幅な機能追加に加え、いくつかの新しい API も発表されました。 その中で、テキストから音声を生成する OpenAI TTS (Text To Speech) API が面白そうだったので、早速ですが簡単に試してみることに。 Text to speech の概要や、API の リファレンスは下記にあります。 Text to speech - OpenAI API Create speech - API Reference - OpenAI API で、ご丁寧に Python や Node.js でのリクエ
Then what? If you’re just starting with TypeScript, you don’t know what configuration you want, so you do what any self-respecting developer would do: steal a config from Stack Overflow: { "compilerOptions": { "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsist
この投稿では、Node.jsバージョン14の新機能を紹介します。 Node.js 14 本日、2020年4月22日にリリースされた v14はLTS(long term support)という3年間の保守が約束されたバージョン。 Node.js 14の今後の予定 Current期間: 2020年4月22日〜2020年10月19日 互換性が保たれる範囲で新機能が追加される。 企業ユーザとしては、アップグレードに備えて、この6ヶ月間にv14でのテストを実施すると良い。 Active LTSの期間: 2020年10月20日〜2021年10月18日 リリースラインに適切な範囲での新機能の追加、バグ修正と保守。 企業ユーザが、本番環境をアップグレードするのに最適な時期。 メンテナンス期間: 2021年10月19日〜2023年4月 重要なバグ修正とセキュリティ更新。 ちなみに、過去のLTSの終了時期は下
JSer.info #669 - Angular v17リリースがリリースされました。 Introducing Angular v17. Last month marked the 13th anniversary… | by Minko Gechev | Nov, 2023 | Angular Blog Release v17.0.0 · angular/angular Node.js 16のサポート終了、ドキュメントサイトの刷新、@ifや@forなどのbuilt-in control flowが追加されています。 新しいプロジェクトでのSSRにおけるhydrationがデフォルトで有効に、ng serveとng buildにViteとesbuildを利用するようになるといった変更も含まれています。 Prettier 3.1がリリースされました。 Prettier 3.1: New ex
Cognitoが全然分からなくて、クライアント側のJavaScriptで使う記事ばかり読んでしまっていた。 aws-amplify とか amazon-cognito-identity-js でめちゃくちゃ悩んだのに、サーバー側なら普通に aws-sdk を使えばよかったのだった。 前提: Cognitoユーザープールの設定この記事では、以下の通りに作成したユーザープールとアプリクライアントを使います。 サインインはユーザー名で行う 必須の標準属性は無し (メアドも無し) ユーザーに自己サインアップを許可しない 一時パスワードの有効期限は1日 (サーバー側で即座に更新するので何日でもいい) 属性は検証しない (メアドも電話番号も無いので) アプリクライアントの『クライアントシークレットを生成』ON (プール作成時しか設定できないので注意) アプリクライアントの『サーバーベースの認証でサイン
2022.02.17 Rails 7: importmap-rails + tailwindcss-railsでnode.jsが不要な理由 Rails 7 : rails newのフロントエンド関連オプションの組み合わせを調べてみた 上の記事に書いたように、Rails 7でimportmap-railsを使う場合、node.jsは不要になり、node_modules/ディレクトリも作成されません。 # デフォルトでimportmap-railsがインストールされる $ rails new . ちょっと不思議だったのは、importmap-railsとtailwindcss-railsを組み合わせた場合にもnode.jsが不要なことです。なお、このセットアップではconfig/importmap.rbにtailwindのエントリは入らず、app/assets/builds/の下にtailwi
この記事について 本記事は、Docker を使って Node.js 開発を始めるための方法について記載しています。 対象読者 Node.js を使って開発を始めたい方 Docker コンテナ上で Node.js アプリケーションを動かしたい方 ホスト OS を綺麗なまま Node.js の開発を行いたい方 はじめに 以前、npm パッケージ n を使って Node.js のバージョン管理を行う方法を投稿しましたが、正直なところ、開発は全部 Docker コンテナ上で行いたいのが理想でした。 そのため、今回は Docker Compose で定義したコンテナで Node.js を実行しようと思います。 環境構築 Docker インストール OS が Windows または macOS の場合は、Docker Desktop をインストールします。 OS が Linux の場合は、以下の記事を
Node.js v17.5 introduces support for fetch() – a popular cross-platform HTTP client API that works in browsers and Web/Service Workers – as an experimental core feature. fetch() support has been a long-requested addition by many, who want to write cross-platform HTTP request code and are familiar with the fetch() API shape and call patterns. So much so that the node-fetch module exists solely to b
結論: Gyazo API のアップロードは Content-Type が不要だがなぜか fileName については暗黙的に要求する 以前の記事でも話した通り、私はパーマネントな画像をすぐに展開できるストレージとして日常的に Gyazo を使っています。 日常的なスクリーンショットでは Gyazo の Desktop App で事足りていたのですが、ちょっと個人的な用事で Bot に画像を添付したいモチベーションが出てきて。 Bot 自体はステートレスに管理したく、また投稿先も Slack なのか何なのかまだ決めていないのもあって、とりあえず Node.js から Gyazo API を叩いてアップロードすることにしました。 ただ5分くらいで終わるかと思ったら、なんやかんや 20 分くらいかかってしまったのでハマりメモとして残しておきます。 Gyazo API について Gyazo には
ChatGPT API(gpt-3.5-turbo)を Node.js から使ってみる(公式リファレンスで参照した情報も記載)JavaScriptNode.jsOpenAIChatGPT はじめに この記事は、提供が開始されたばかりの「ChatGPT API」を、早速 Node.js で試してみたという話です。 ChatGPT API の提供が始まった話は、「Introducing ChatGPT and Whisper APIs」という公式の記事を、今朝方見かけて知りました。 API の利用料金 Pricing のページ を見ると、ChatGPT API(gpt-3.5-turbo)の料金は、「$0.002 / 1K tokens」となっているようです。 公式の技術情報について 今回は Node.js を使って進めたのですが、その際に参照した公式の情報についても書いてみます。 Node.
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く