mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 19:25:23 +00:00
Improved Readme to include ESM import
This commit is contained in:
26
README.md
26
README.md
@@ -122,15 +122,23 @@ This is a standard procedure: you would have to do it also without using this li
|
|||||||
|
|
||||||
## Usage Examples
|
## Usage Examples
|
||||||
|
|
||||||
#### Folder Model
|
Importing:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
/**
|
/** CommonJS **/
|
||||||
* Use `const { PKPass } = require("passkit-generator");`
|
const { PKPass } = require("passkit-generator");
|
||||||
* for usage in CommonJS (Node.js)
|
|
||||||
*/
|
/** Typescript **/
|
||||||
import { PKPass } from "passkit-generator";
|
import { PKPass } from "passkit-generator";
|
||||||
|
|
||||||
|
/** ESM **/
|
||||||
|
import passkit from "passkit-generator";
|
||||||
|
const PKPass = passkit.PKPass;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Folder Model
|
||||||
|
|
||||||
|
```typescript
|
||||||
try {
|
try {
|
||||||
/** Each, but last, can be either a string or a Buffer. See API Documentation for more */
|
/** Each, but last, can be either a string or a Buffer. See API Documentation for more */
|
||||||
const { wwdr, signerCert, signerKey, signerKeyPassphrase } = getCertificatesContentsSomehow();
|
const { wwdr, signerCert, signerKey, signerKeyPassphrase } = getCertificatesContentsSomehow();
|
||||||
@@ -169,15 +177,9 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Buffer Model
|
### Buffer Model
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
/**
|
|
||||||
* Use `const { PKPass } = require("passkit-generator");`
|
|
||||||
* for usage in CommonJS (Node.js)
|
|
||||||
*/
|
|
||||||
import { PKPass } from "passkit-generator";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/** Each, but last, can be either a string or a Buffer. See API Documentation for more */
|
/** Each, but last, can be either a string or a Buffer. See API Documentation for more */
|
||||||
const { wwdr, signerCert, signerKey, signerKeyPassphrase } = getCertificatesContentsSomehow();
|
const { wwdr, signerCert, signerKey, signerKeyPassphrase } = getCertificatesContentsSomehow();
|
||||||
|
|||||||
Reference in New Issue
Block a user