@spacehq/sdk > UserStorage > txlSubscribe
UserStorage.txlSubscribe() method
txlSubscribe is used to listen for Textile events.
It listens to all buckets for the user and produces an event when something changes in the bucket.
TODO: try to make the event more granular so we can pick up specific files/folders
Signature:
txlSubscribe(): Promise<TxlSubscribeResponse>;
Returns:
Promise<TxlSubscribeResponse>
Example
const spaceStorage = new UserStorage(spaceUser);
await spaceStorage.initListener();
const response = await spaceStorage.txlSubscribe();
response.on('data', (data: TxlSubscriveEvent) => {
const { bucketName } = data as AddItemsStatus;
// bucketName would be the name of the bucket
});