or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

tessl/npm-prisma--get-platform

Platform detection utility for Prisma's internal use that detects operating system, architecture, and Linux distribution information to determine appropriate binary targets for Prisma engines.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@prisma/get-platform@6.15.x

To install, run

npx @tessl/cli install tessl/npm-prisma--get-platform@6.15.0

0

# @prisma/get-platform

1

2

@prisma/get-platform is a TypeScript platform detection utility specifically designed for Prisma's internal infrastructure needs. It provides comprehensive system analysis including operating system identification, CPU architecture detection, and detailed Linux distribution classification with family grouping. The library maps detected platform characteristics to appropriate binary targets for Prisma engines and handles edge cases across diverse deployment environments.

3

4

## Package Information

5

6

- **Package Name**: @prisma/get-platform

7

- **Package Type**: npm

8

- **Language**: TypeScript

9

- **Installation**: `npm install @prisma/get-platform`

10

11

## Core Imports

12

13

```typescript

14

import {

15

getBinaryTargetForCurrentPlatform,

16

getPlatformInfo,

17

assertNodeAPISupported,

18

getNodeAPIName,

19

getos,

20

link,

21

type BinaryTarget,

22

type PlatformInfo,

23

binaryTargets

24

} from "@prisma/get-platform";

25

```

26

27

For CommonJS:

28

29

```javascript

30

const { getBinaryTargetForCurrentPlatform, getPlatformInfo } = require("@prisma/get-platform");

31

```

32

33

Test utilities (Jest only - exported through main package):

34

35

```typescript

36

import {

37

jestContext,

38

jestConsoleContext,

39

jestStdoutContext,

40

processExitContext,

41

type BaseContext,

42

type ProcessContextSettings

43

} from "@prisma/get-platform";

44

```

45

46

## Basic Usage

47

48

```typescript

49

import { getBinaryTargetForCurrentPlatform, getPlatformInfo } from "@prisma/get-platform";

50

51

// Get the binary target for current platform

52

const binaryTarget = await getBinaryTargetForCurrentPlatform();

53

console.log(binaryTarget); // e.g., "linux-musl-arm64-openssl-3.0.x"

54

55

// Get comprehensive platform information

56

const platformInfo = await getPlatformInfo();

57

console.log(platformInfo.platform); // e.g., "linux"

58

console.log(platformInfo.arch); // e.g., "arm64"

59

console.log(platformInfo.binaryTarget); // e.g., "linux-musl-arm64-openssl-3.0.x"

60

```

61

62

## Architecture

63

64

@prisma/get-platform is built around several key components:

65

66

- **Platform Detection Engine**: Core functionality for detecting OS, architecture, and distribution information

67

- **Binary Target Resolution**: Mapping platform characteristics to Prisma engine binary targets

68

- **SSL Version Detection**: Specialized Linux SSL library version detection for engine compatibility

69

- **Node API Compatibility**: Validation utilities for Node.js API support

70

- **Test Utilities**: Comprehensive testing framework utilities for platform-related testing

71

72

## Capabilities

73

74

### Platform Detection

75

76

Core platform detection functionality that identifies the current operating system, CPU architecture, and detailed Linux distribution information.

77

78

```typescript { .api }

79

function getBinaryTargetForCurrentPlatform(): Promise<BinaryTarget>;

80

81

function getPlatformInfo(): Promise<PlatformInfo>;

82

83

function getos(): Promise<GetOSResult>;

84

```

85

86

[Platform Detection](./platform-detection.md)

87

88

### Binary Target Resolution

89

90

Binary target system that maps platform characteristics to appropriate Prisma engine targets, supporting 33+ different platform configurations.

91

92

```typescript { .api }

93

type BinaryTarget =

94

| 'native'

95

| 'darwin'

96

| 'darwin-arm64'

97

| 'debian-openssl-1.0.x'

98

| 'debian-openssl-1.1.x'

99

| 'debian-openssl-3.0.x'

100

| 'rhel-openssl-1.0.x'

101

| 'rhel-openssl-1.1.x'

102

| 'rhel-openssl-3.0.x'

103

| 'linux-arm64-openssl-1.1.x'

104

| 'linux-arm64-openssl-1.0.x'

105

| 'linux-arm64-openssl-3.0.x'

106

| 'linux-arm-openssl-1.1.x'

107

| 'linux-arm-openssl-1.0.x'

108

| 'linux-arm-openssl-3.0.x'

109

| 'linux-musl'

110

| 'linux-musl-openssl-3.0.x'

111

| 'linux-musl-arm64-openssl-1.1.x'

112

| 'linux-musl-arm64-openssl-3.0.x'

113

| 'linux-nixos'

114

| 'linux-static-x64'

115

| 'linux-static-arm64'

116

| 'windows'

117

| 'freebsd11'

118

| 'freebsd12'

119

| 'freebsd13'

120

| 'freebsd14'

121

| 'freebsd15'

122

| 'openbsd'

123

| 'netbsd'

124

| 'arm';

125

126

const binaryTargets: BinaryTarget[];

127

```

128

129

[Binary Targets](./binary-targets.md)

130

131

### Node API Support

132

133

Node.js API compatibility validation for ensuring proper engine type selection based on platform capabilities.

134

135

```typescript { .api }

136

function assertNodeAPISupported(): void;

137

138

function getNodeAPIName(binaryTarget: BinaryTarget, type: 'url' | 'fs'): string;

139

```

140

141

[Node API Support](./node-api-support.md)

142

143

### Test Utilities

144

145

Testing utilities for platform-related functionality. Jest utilities are officially exported through the main package.

146

147

```typescript { .api }

148

// Jest utilities (exported through main package)

149

const jestContext: ContextFactory;

150

const jestConsoleContext: ContextContributor;

151

const jestStdoutContext: ContextContributor;

152

const processExitContext: ContextContributor;

153

154

// Base types

155

type BaseContext: TestContext;

156

type ProcessContextSettings: Settings;

157

158

// Utility function

159

function link(url: any): string;

160

```

161

162

[Test Utilities](./test-utilities.md)

163

164

## Types

165

166

```typescript { .api }

167

interface PlatformInfo extends GetOSResult {

168

binaryTarget: BinaryTarget;

169

}

170

171

interface GetOSResult {

172

platform: NodeJS.Platform;

173

arch: Arch;

174

targetDistro?: 'rhel' | 'debian' | 'musl' | 'arm' | 'nixos' | 'freebsd11' | 'freebsd12' | 'freebsd13' | 'freebsd14' | 'freebsd15';

175

familyDistro?: string;

176

originalDistro?: string;

177

archFromUname?: string;

178

libssl?: '1.0.x' | '1.1.x' | '3.0.x';

179

}

180

181

type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | 's390' | 's390x' | 'mipsel' | 'ia32' | 'mips' | 'ppc' | 'ppc64';

182

183

interface DistroInfo {

184

originalDistro?: string;

185

familyDistro?: string;

186

targetDistro?: 'rhel' | 'debian' | 'musl' | 'arm' | 'nixos' | 'freebsd11' | 'freebsd12' | 'freebsd13' | 'freebsd14' | 'freebsd15';

187

}

188

```