- version: 1.0.5
- Last update: October 2025
- Environment: VS Code Devcontainer, Docker
- Prerequisite: Prerequisite
Example Code Disclaimer: ALL EXAMPLE CODE IS PROVIDED ON AN “AS IS” AND “AS AVAILABLE” BASIS FOR ILLUSTRATIVE PURPOSES ONLY. REFINITIV MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, AS TO THE OPERATION OF THE EXAMPLE CODE, OR THE INFORMATION, CONTENT, OR MATERIALS USED IN CONNECTION WITH THE EXAMPLE CODE. YOU EXPRESSLY AGREE THAT YOUR USE OF THE EXAMPLE CODE IS AT YOUR SOLE RISK.
Bun is a new JavaScript runtime that aims to be a drop-in replacement for Node.js with faster startup and run time, more optimized API, and provides a complete toolkit for JavaScript/TypeScript developers.
Bun just released version 1.0 ("production-ready") on September 2023 (the current version is 1.0.21, as of January 2024).
One of Bun features is the Node.js compatibility. Most NPM modules intended to work with Node.js will work with Bun out of the box. This is a good opportunity to test Data Library for TypeScript with Bun runtime to consume data from Data Platform (aka Delivery Platform or RDP, formerly known as Refinitiv Data Platform) as an experimental project.
This example project shows how to implement a console TypeScript application to retrieve financial data using ease-of-use Data Library for TypeScript version 1 on Bun runtime. The project is implemented and run in a controlled environment such as Docker and devcontainer using the Bun Docker Image.
Update October 2025: The Data Library for TypeScript version 2 (aka LSEG Data Library for TypeScript) is now available.
Note:
- Please be informed that this demo project aims for Development and POC purposes only. The Data Library for TypeScript/JavaScript is not tested and qualified with Bun runtime.
- This project uses Bun version 1.0.21.
Bun is an all-in-one JavaScript runtime and toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager. Bun is built from scratch using the Zig programming language. Unlike Node.js and Deno that use Chromium's V8, Bun uses WebKit's JavaScriptCore as the JavaScript Engine.
The three major design goals of Bun are as follows:
- Speed: Bun starts fast and runs fast. It extends JavaScriptCore, the performance-minded JS engine built for Safari.
- Elegant APIs: Bun provides a minimal set of highly-optimized APIs for performing common tasks, like starting an HTTP server and writing files.
- Cohesive DX: Bun is a complete toolkit for building JavaScript apps, including a package manager, test runner, and bundler.
Bun is designed as a drop-in replacement for Node.js. It natively implements hundreds of Node.js and Web APIs, including fs, path, Buffer and much more to improve performance and developers productivity.
Benchmark result from Bun website.
For more detail about Bun runtime, please check the following resources:
This project was created using bun init command in bun v1.0.21.
The Data Library for TypeScript is an ease-of-use API defining a set of uniform interfaces providing the developer access to the Data Platform. The APIs are designed to provide consistent access through multiple access channels, spanning multiple programming languages that target both Professional Developers and Financial Coders. Developers can choose to access content from the desktop, within a desktop container, through their deployed streaming services, or directly to the cloud. The interfaces encompass a set of unified Web APIs providing access to both streaming (over WebSockets) and non-streaming (HTTP REST) data available within the platform.
The Libraries are available in the following programming languages:
For more deep detail regarding the Data Library for Python version1, please refer to the following articles and tutorials:
Update October 2025: The Data Library for TypeScript version 2 (aka LSEG Data Library for TypeScript) is now available.
This project is based on Data Library for TypeScript version 1 (RD Library TypeScript) using the Platform Session only.
Before I am going further, there is some prerequisite, dependencies, and libraries that the project is needed.
This project uses RDP access credentials with the CFS file, Pricing History, and News permissions.
Please contact your LSEG representative to help you with the RDP account and services.
This demonstration connects to RDP on AWS via a public internet.
This project uses Docker Desktop for containerization.
Optionally, you can use the Visual Studio Code with Dev Containers extension to run and debug the example code.
Please check the Article.md document page.
The first step is to unzip or download the example project folder into a directory of your choice, then set up Python or Postman environments based on your preference.
-
Start a Docker desktop or Docker engine on your machine.
-
Install the VS Code - Remote Development extension pack.
-
Once the extension installation process is success, create a
devcontainer.envfile in the.devcontainerfolder with the following contentRDP_USERNAME=<Your RDP Username> RDP_PASSWORD=<Your RDP Password> RDP_APP_KEY=<Your RDP App key>
-
Open the VS Code Command Palette with the
F1key, and then select the Remote-Containers: Reopen in Container command. -
Once this build is completed, VS Code automatically connects to the container, and automatics initializes the project for developers. Now VS Code is ready for running and testing the Project inside this devcontainer.
-
To run the RD - Library content layer examples:
bun run src/rdlib_historical-pricing.ts bun run src/rdlib_news.ts
-
To run the RD - Library Delivery layer examples:
bun run src/rdlib_cfsWorkflow.ts
or
bun start
- Start a Docker desktop or Docker engine on your machine.
- create a
.envfile in the project folder with the following contentRDP_USERNAME=<Your RDP Username> RDP_PASSWORD=<Your RDP Password> RDP_APP_KEY=<Your RDP App key>
- Build a Docker image with the following command:
docker build . -t bun_datalibrary_ts - Once this build is completed, run a Docker container with the following command:
docker run -it --name bun_datalibrary_ts --env-file .env -v <full path to outputCFS folder>:/app/outputCFS bun_datalibrary_ts
- To stop and delete a Docker container, press
Ctrl+C(or rundocker stop bun_datalibrary_ts) then run the following command:docker rm bun_datalibrary_ts
- To delete a Docker bun_datalibrary_ts image, run the following command:
docker rmi bun_datalibrary_ts
Before I finish, let me just say while the Node.js is still a de factor platform for the JavaScript/TypeScript application development, Bun is a good alternative platform for JavaScript/TypeScript developers. It provides a fast runtime, simplify APIs, well written document, and all-in-one toolkit (development, runtime, test, and bundler) for developers. The Node.js-compatible package manager is also a killer feature that makes Node.js developers feel right-at-home when using Bun.
This leads to how easy to use Bun with the easy-to-use Data Library for TypeScript. When combining the library development experience with Bun runtime and toolset, developers can create applications that connect and consume data from the Data Platform (aka Delivery Platform or RDP, formerly known as Refinitiv Data Platform) easier and faster when comparing to using Node.js.
However, please be noticed that the Data Library for TypeScript is not qualified with Bun runtime yet. But this Prove of Concept (POC) project shows that once the Bun becomes a mainstream platform, developers can start using it with the Data Library with confident.
That brings me to the end of my Bun - Data Library TypeScript project. For further details, please check out the following resources:
- Data Library for TypeScript version 1 page on the LSEG Developer Community website.
- Data Library for TypeScript version 2.
- Getting started with Data Library for TypeScript version 1.
- Data Library for TypeScript Tutorials version 1.
- Data Library for TypeScript Examples.
- Bun Official website.
- Bun Official Documents.
- Bun Official Guides.
- Bun Official Guides: Install TypeScript declarations for Bun.
- Bun Official Guides: Containerize a Bun application with Docker.
- How To Dockerize A Bun App blog post.
- Bun on DockerHub.
For any questions related to Data Library for TypeScript, please use the Developers Community Q&A page page.

